auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Entity call() throws Exception { Iterable<Entity> entitiesToSearch = null; switch (scope) { case THIS: return getEntity(); case PARENT: return getEntity().getParent(); case GLOBAL: entitiesToSearch = ((EntityManagerInternal)getEntity().getManagementContext().getEntityManager()) .getAllEntitiesInApplication( entity().getApplication() ); break; case DESCENDANT: entitiesToSearch = Entities.descendants(getEntity()); break; case ANCESTOR: entitiesToSearch = Entities.ancestors(getEntity()); break; case SIBLING: entitiesToSearch = getEntity().getParent().getChildren(); break; case CHILD: entitiesToSearch = getEntity().getChildren(); break; default: throw new IllegalStateException("Unexpected scope "+scope); } Predicate<Entity> configEqualTo = EntityPredicates.configEqualTo(BrooklynCampConstants.PLAN_ID, componentId); Predicate<Entity> classNameEquals = EntityPredicates.classNameEquals(componentId); Optional<Entity> result = Iterables.tryFind(entitiesToSearch, Predicates.or(configEqualTo, classNameEquals)); if (result.isPresent()) return result.get(); throw new NoSuchElementException("No entity matching id or type " + componentId+ (scope==Scope.GLOBAL ? "" : ", in scope "+scope+" wrt "+getEntity()+ (scopeComponent!=null ? " ("+scopeComponent+" from "+entity()+")" : ""))); }

Target:
public Entity call() throws Exception { Iterable<Entity> entitiesToSearch = null; switch (scope) { case THIS: return getEntity(); case PARENT: return getEntity().getParent(); case GLOBAL: entitiesToSearch = ((EntityManagerInternal)getEntity().getManagementContext().getEntityManager()) .getAllEntitiesInApplication( entity().getApplication() ); break; case DESCENDANT: entitiesToSearch = Entities.descendants(getEntity()); break; case ANCESTOR: entitiesToSearch = Entities.ancestors(getEntity()); break; case SIBLING: entitiesToSearch = getEntity().getParent().getChildren(); break; case CHILD: entitiesToSearch = getEntity().getChildren(); break; default: throw new IllegalStateException("Unexpected scope "+scope); } Predicate<Entity> configEqualTo = EntityPredicates.configEqualTo(BrooklynCampConstants.PLAN_ID, componentId); Optional<Entity> result = Iterables.tryFind(entitiesToSearch, configEqualTo); if (result.isPresent()) return result.get(); Predicate<Entity> typeNameEquals = EntityPredicates.typeNameEquals(componentId); result = Iterables.tryFind(entitiesToSearch, typeNameEquals); if (result.isPresent()) return result.get(); throw new NoSuchElementException("No entity matching id or type " + componentId+ (scope==Scope.GLOBAL ? "" : ", in scope "+scope+" wrt "+getEntity()+ (scopeComponent!=null ? " ("+scopeComponent+" from "+entity()+")" : ""))); }
Source:
public ControlPoint[] getManageableControlPoints() { final Point2DArray controlPoints = getControlPoints(); if (null != controlPoints) { final int size = controlPoints.size() - 2; final ControlPoint[] cps = new ControlPoint[size]; for (int i = 1; i <= size; i++) { final com.ait.lienzo.client.core.types.Point2D controlPoint = controlPoints.get(i); cps[i - 1] = ControlPoint.build(controlPoint.getX(), controlPoint.getY()); } return cps; } return new ControlPoint[0]; }

Target:
public ControlPoint[] getManageableControlPoints() { final Point2DArray controlPoints = getControlPoints(); if (null != controlPoints && controlPoints.size() > 2) { return StreamSupport.stream(controlPoints.spliterator(), false) .limit(controlPoints.size() - 1) .skip(1) .map(controlPoint -> ControlPoint.build(controlPoint.getX(), controlPoint.getY())) .toArray(ControlPoint[]::new); } return new ControlPoint[0]; }
Source:
private Element getRowElement(final String uuid) { return getElement().parentNode.querySelector("[data-row-uuid=\"" + uuid + "\"]"); }

Target:
private Element getRowElement(final String uuid) { return getElement().parentNode.querySelector("[" + UUID_ATTR + "=\"" + uuid + "\"]"); }
Source:
private void assignLowLatency(JsonObject llStart) { final String lowLatencyTag = "__spl_lowLatencyRegionId" + lowLatencyRegionCount++; Set<JsonObject> llStartChildren = getDownstream(llStart, graph); Boolean[] isAlreadyTagged = {false}; llStartChildren.forEach(oper -> { JsonObject placement = object(oper, CONFIG, PLACEMENT); if(placement!=null && jstring(placement, PLACEMENT_LOW_LATENCY_REGION_ID) != null) isAlreadyTagged[0]=true; }); if(isAlreadyTagged[0]) return; Set<BVirtualMarker> boundaries = EnumSet.of(LOW_LATENCY, END_LOW_LATENCY); GraphUtilities.visitOnce(llStartChildren, boundaries, graph, new Consumer<JsonObject>() { @Override public void accept(JsonObject op) { JsonObject placement = objectCreate(op, CONFIG, PLACEMENT); assert jstring(placement, PLACEMENT_LOW_LATENCY_REGION_ID) == null || jstring(placement, PLACEMENT_LOW_LATENCY_REGION_ID).equals(lowLatencyTag); placement.addProperty(PLACEMENT_LOW_LATENCY_REGION_ID, lowLatencyTag); } }); }

Target:
private void assignLowLatency(JsonObject llStart) { final String lowLatencyTag = "__spl_lowLatencyRegionId" + lowLatencyRegionCount++; Set<JsonObject> llStartChildren = getDownstream(llStart, graph); AtomicBoolean isAlreadyTagged = new AtomicBoolean(false); llStartChildren.forEach(oper -> { JsonObject placement = object(oper, CONFIG, PLACEMENT); if(placement!=null && jstring(placement, PLACEMENT_LOW_LATENCY_REGION_ID) != null) isAlreadyTagged.set(true);; }); if(isAlreadyTagged.get()) return; Set<BVirtualMarker> boundaries = EnumSet.of(LOW_LATENCY, END_LOW_LATENCY); GraphUtilities.visitOnce(llStartChildren, boundaries, graph, new Consumer<JsonObject>() { @Override public void accept(JsonObject op) { JsonObject placement = objectCreate(op, CONFIG, PLACEMENT); assert jstring(placement, PLACEMENT_LOW_LATENCY_REGION_ID) == null || jstring(placement, PLACEMENT_LOW_LATENCY_REGION_ID).equals(lowLatencyTag); placement.addProperty(PLACEMENT_LOW_LATENCY_REGION_ID, lowLatencyTag); } }); }
Source:
private Function<PollingContext<OperationResult>, Mono<OperationResult>> receiptStreamActivationOperation( Flux<ByteBuffer> data, long length, FormContentType formContentType, boolean includeTextDetails) { Objects.requireNonNull(data, "'data' is required and cannot be null."); final long[] bufferedDataSize = {0}; final List<ByteBuffer> cachedBuffers = new LinkedList<>(); final AtomicBoolean[] isGuessed = {new AtomicBoolean(true)}; final ContentType[] contentType = new ContentType[1]; return pollingContext -> data.filter(ByteBuffer::hasRemaining) .windowUntil(buffer -> { if (bufferedDataSize[0] >= length) { return false; } bufferedDataSize[0] += buffer.remaining(); if (formContentType == null && isGuessed[0].get() && bufferedDataSize[0] >= 4) { byte[] bytes = buffer.array(); contentType[0] = getContentType(ByteBuffer.wrap(bytes)); isGuessed[0].compareAndSet(true, false); } ByteBuffer cachedBuffer = ByteBuffer.allocate(buffer.remaining()).put(buffer); cachedBuffer.flip(); cachedBuffers.add(cachedBuffer); if (bufferedDataSize[0] >= length) { return true; } return false; }, true, Integer.MAX_VALUE) .next() .flatMap(newData -> { final ContentType contentTypeFinal = formContentType == null ? contentType[0] : ContentType.fromString(formContentType.toString()); return service.analyzeReceiptAsyncWithResponseAsync(contentTypeFinal, Flux.fromIterable(cachedBuffers), length, includeTextDetails).map(response -> new OperationResult( parseModelId(response.getDeserializedHeaders().getOperationLocation()))); }); }

Target:
private Function<PollingContext<OperationResult>, Mono<OperationResult>> receiptStreamActivationOperation( Flux<ByteBuffer> data, long length, FormContentType formContentType, boolean includeTextDetails) { Objects.requireNonNull(data, "'data' is required and cannot be null."); return pollingContext -> { if (formContentType != null) { try { return service.analyzeReceiptAsyncWithResponseAsync( ContentType.fromString(formContentType.toString()), data, length, includeTextDetails) .map(response -> new OperationResult( parseModelId(response.getDeserializedHeaders().getOperationLocation()))); } catch (RuntimeException ex) { return monoError(logger, ex); } } else { return detectContentType(data) .flatMap(contentType -> service.analyzeReceiptAsyncWithResponseAsync(contentType, data, length, includeTextDetails) .map(response -> new OperationResult( parseModelId(response.getDeserializedHeaders().getOperationLocation())))); } }; }
Source:
public void onError(Throwable cause) { cause.printStackTrace(System.out); }

Target:
public void onError(Throwable cause) { logger.error("Error while streaming audio data to transcription service" , cause); }
Source:
public void setButtonData(UIInputBind bindButton) { this.bindButton = bindButton; String messageText = "Key " + bindButton.getNewInput().getDisplayName() + " has already been assigned an action. Press ok to change anyway."; find("title", UILabel.class).setText("Rebinding"); find("message", UILabel.class).setText(messageText); }

Target:
public void setButtonData(UIInputBind bindButton) { this.bindButton = bindButton; String messageText = "Key " + bindButton.getNewInput().getDisplayName() + " has already been assigned an action. Press ok to change anyway."; find("message", UILabel.class).setText(messageText); }
Source:
public <T extends DataSerializable> Optional<DataBuilder<T>> getBuilder(Class<T> clazz) { Preconditions.checkNotNull(clazz); if (this.builders.containsKey(clazz)) { return Optional.of((DataBuilder<T>) this.builders.get(clazz)); } else if (this.immutableDataBuilderMap.containsKey(clazz)) { return Optional.of((DataBuilder<T>) this.immutableDataBuilderMap.get(clazz)); } else { return Optional.empty(); } }

Target:
public <T extends DataSerializable> Optional<DataBuilder<T>> getBuilder(Class<T> clazz) { Preconditions.checkNotNull(clazz); DataBuilder<?> dataBuilder = this.builders.get(clazz); if (dataBuilder != null) { return Optional.of((DataBuilder<T>) dataBuilder); } return Optional.ofNullable((DataBuilder<T>) this.immutableDataBuilderMap.get(clazz)); }
Source:
public DistributedObjectEvent(EventType eventType, String serviceName, String objectName, DistributedObject distributedObject, UUID source) { super(source); this.eventType = eventType; this.serviceName = serviceName; this.objectName = objectName; this.distributedObject = distributedObject; this.source = source; }

Target:
public DistributedObjectEvent(EventType eventType, String serviceName, String objectName, DistributedObject distributedObject, UUID source) { super(source); this.eventType = eventType; this.serviceName = serviceName; this.objectName = objectName; this.distributedObject = distributedObject; }
Source:
public Response<Key> getKey() { return withContext(context -> client.getKey(context)).block(); }

Target:
public Key getKey() { return getKeyWithResponse(Context.NONE).value(); }
Source:
protected ListBranchesResult() { this(new ArrayList<Branch>(), false); }

Target:
protected ListBranchesResult() { }
Source:
public TablespaceProto getTablespace(final String tablespaceName) throws UndefinedTableException { try { final BlockingInterface stub = getStub(); final GetTablespaceResponse response = stub.getTablespace(null, ProtoUtil.convertString(tablespaceName)); throwsIfThisError(response.getState(), UndefinedTableException.class); ensureOk(response.getState()); return response.getTablespace(); } catch (ServiceException e) { throw new RuntimeException(e); } }

Target:
public TablespaceProto getTablespace(final String tablespaceName) throws UndefinedTablespaceException { try { final BlockingInterface stub = getStub(); final GetTablespaceResponse response = stub.getTablespace(null, ProtoUtil.convertString(tablespaceName)); throwsIfThisError(response.getState(), UndefinedTablespaceException.class); ensureOk(response.getState()); return response.getTablespace(); } catch (ServiceException e) { throw new RuntimeException(e); } }
Source:
public final void setClockSkew(Duration clockSkew) { Assert.notNull(clockSkew, "clockSkew cannot be null"); Assert.isTrue(clockSkew.compareTo(MINIMUM_CLOCK_SKEW) >=0, "clockSkew should be greater than 0"); this.clockSkew = clockSkew; }

Target:
public final void setClockSkew(Duration clockSkew) { Assert.notNull(clockSkew, "clockSkew cannot be null"); Assert.isTrue(clockSkew.getSeconds() >= 0, "clockSkew must be >= 0"); this.clockSkew = clockSkew; }
Source:
public Collection<SerializationContextInitializer> getContextInitializers() { return contextInitializers; }

Target:
public List<SerializationContextInitializer> getContextInitializers() { return contextInitializers; }
Source:
public void testHeaderBytes() { final String expectedHeaderString = "LA:testProject \n" + (char) 0x1A + ("ST:3 \n" + (char) 0x1A + "CO:1 \n" + (char) 0x1A + "+X:20 \n" + (char) 0x1A + "-X:0 \n" + (char) 0x1A + "+Y:20 \n" + (char) 0x1A + "-Y:0 \n" + (char) 0x1A + "AX:0 \n" + (char) 0x1A + "AY:0 \n" + (char) 0x1A + "MX:0 \n" + (char) 0x1A + "MY:0 \n" + (char) 0x1A + "PD:*****\n" + (char) 0x1A).replace(' ', '\0') + String.format("%388s", " "); EmbroideryList points = new EmbroideryList(); points.add(new PointF(0, 0)); points.add(new PointF(10, 10)); points.add(new PointF(0, 0)); ArrayList<DSTFileGenerator.StitchPoint> stitchPoints = fileGenerator.prepareStitchPoints(points); byte[] header = fileGenerator.getHeaderBytes(stitchPoints); byte[] expectedHeader = expectedHeaderString.getBytes(); assertEquals(DSTFileGenerator.HEADERMAXBYTE, header.length); assertArrayEquals(expectedHeader, header); }

Target:
public void testHeaderBytes() { final String expectedHeaderString = "LA:DSTFileGenerato\n" + (char) 0x1A + ("ST:3 \n" + (char) 0x1A + "CO:1 \n" + (char) 0x1A + "+X:20 \n" + (char) 0x1A + "-X:0 \n" + (char) 0x1A + "+Y:20 \n" + (char) 0x1A + "-Y:0 \n" + (char) 0x1A + "AX:0 \n" + (char) 0x1A + "AY:0 \n" + (char) 0x1A + "MX:0 \n" + (char) 0x1A + "MY:0 \n" + (char) 0x1A + "PD:*****\n" + (char) 0x1A).replace(' ', '\0') + String.format("%388s", " "); EmbroideryList points = new EmbroideryList(); points.add(new PointF(0, 0)); points.add(new PointF(10, 10)); points.add(new PointF(0, 0)); ArrayList<DSTFileGenerator.StitchPoint> stitchPoints = fileGenerator.prepareStitchPoints(points); byte[] header = fileGenerator.getHeaderBytes(stitchPoints); byte[] expectedHeader = expectedHeaderString.getBytes(); assertArrayEquals(expectedHeader, header); }
Source:
private void equalizeIrrelevantData(CourseAttributes expected, CourseAttributes actual) { expected.createdAt = actual.createdAt; expected.sanitizeForSaving(); }

Target:
private void equalizeIrrelevantData(CourseAttributes expected, CourseAttributes actual) { expected.createdAt = actual.createdAt; }
Source:
public List<FeedbackQuestionAttributes> getFeedbackQuestionsForStudent( String feedbackSessionName, String courseId, StudentAttributes student) { List<FeedbackQuestionAttributes> questions = new ArrayList<FeedbackQuestionAttributes>(); questions.addAll( fqDb.getFeedbackQuestionsForGiverType( feedbackSessionName, courseId, FeedbackParticipantType.STUDENTS)); questions.addAll( fqDb.getFeedbackQuestionsForGiverType( feedbackSessionName, courseId, FeedbackParticipantType.TEAMS)); List<FeedbackQuestionAttributes> questionsWithCustomFeedbackPaths = fqDb.getFeedbackQuestionsForGiverType( feedbackSessionName, courseId, FeedbackParticipantType.CUSTOM); for (FeedbackQuestionAttributes question : questionsWithCustomFeedbackPaths) { if (question.hasStudentAsGiverInFeedbackPathAttributesList(student)) { questions.add(question); } } Collections.sort(questions); return questions; }

Target:
public List<FeedbackQuestionAttributes> getFeedbackQuestionsForStudent( String feedbackSessionName, String courseId, StudentAttributes student) { List<FeedbackQuestionAttributes> questions = new ArrayList<FeedbackQuestionAttributes>(); questions.addAll( fqDb.getFeedbackQuestionsForGiverType( feedbackSessionName, courseId, FeedbackParticipantType.STUDENTS)); questions.addAll( fqDb.getFeedbackQuestionsForGiverType( feedbackSessionName, courseId, FeedbackParticipantType.TEAMS)); List<FeedbackQuestionAttributes> questionsWithCustomFeedbackPaths = fqDb.getFeedbackQuestionsForGiverType( feedbackSessionName, courseId, FeedbackParticipantType.CUSTOM); for (FeedbackQuestionAttributes question : questionsWithCustomFeedbackPaths) { if (question.hasStudentAsGiverInFeedbackPaths(student)) { questions.add(question); } } Collections.sort(questions); return questions; }
Source:
public void shouldUpdateDocumentConcurrently() throws Exception { final String key = testName.getMethodName(); remove(key); final AtomicLong counter = new AtomicLong(); VersionedData initial = new VersionedData(key, "value-initial"); versionedDataRepository.save(initial); assertNotEquals(0L, initial.version); Callable<Void> task = new Callable<Void>() { @Override public Void call() throws Exception { boolean saved = false; while(!saved) { long counterValue = counter.incrementAndGet(); VersionedData messageData = versionedDataRepository.findOne(key); messageData.data = "value-" + counterValue; try { versionedDataRepository.save(messageData); saved = true; } catch (OptimisticLockingFailureException e) { } } return null; } }; AsyncUtils.executeConcurrently(5, task); assertNotEquals(initial.data, versionedDataRepository.findOne(key).data); }

Target:
public void shouldUpdateDocumentConcurrently() throws Exception { final String key = testName.getMethodName(); remove(key); final AtomicLong counter = new AtomicLong(); final AtomicLong updatedCounter = new AtomicLong(); VersionedData initial = new VersionedData(key, "value-initial"); versionedDataRepository.save(initial); assertNotEquals(0L, initial.version); Callable<Void> task = new Callable<Void>() { @Override public Void call() throws Exception { boolean updated = false; while(!updated) { long counterValue = counter.incrementAndGet(); VersionedData messageData = versionedDataRepository.findOne(key); messageData.data = "value-" + counterValue; try { versionedDataRepository.save(messageData); updated = true; updatedCounter.incrementAndGet(); } catch (OptimisticLockingFailureException e) { } } return null; } }; AsyncUtils.executeConcurrently(5, task); assertNotEquals(initial.data, versionedDataRepository.findOne(key).data); assertEquals(5, updatedCounter.intValue()); }
Source:
public void doPrefetch(int index, long relativeOffset, long size) { try { readOptions.get(index).doPrefetch(relativeOffset, size); } catch (Exception e) { logger.error("Data Prefetch failed", e); } }

Target:
public void doPrefetch(int index, long relativeOffset, long size) throws IOException { readOptions.get(index).doPrefetch(relativeOffset, size); }
Source:
private Key readKey(InputStream input) throws IOException { byte[] data = new byte[260]; input.read(data, 0, 4); input.read(data, 0, 256); SRand srand = new SRand(LittleEndian.getInt(data)); byte xor = 0; for (int i = 0, n = 0; i < 256; i++, n--) { if (n == 0) { xor = (byte) (srand.rand() & 0xFF); n = (int) ((srand.rand() & 0xF) + 1); } if (i >= 4) { data[i] = (byte) ((data[i]) ^ (xor)); } } int offset = 4 + (data[0] & 0xF); byte[] key = Arrays.copyOfRange(data, offset, offset + 16); SecretKeySpec secretKey = new SecretKeySpec(key, "AES"); return secretKey; }

Target:
private Key readKey(InputStream input) throws IOException { byte[] data = new byte[260]; if (IOUtils.readFully(input, data, 0, 4) != 4) throw new EOFException(); if (IOUtils.readFully(input, data, 0, 256) != 256) throw new EOFException(); SRand srand = new SRand(LittleEndian.getInt(data)); byte xor = 0; for (int i = 0, n = 0; i < 256; i++, n--) { if (n == 0) { xor = (byte) (srand.rand() & 0xFF); n = (int) ((srand.rand() & 0xF) + 1); } if (i >= 4) { data[i] = (byte) ((data[i]) ^ (xor)); } } int offset = 4 + (data[0] & 0xF); byte[] key = Arrays.copyOfRange(data, offset, offset + 16); SecretKeySpec secretKey = new SecretKeySpec(key, "AES"); return secretKey; }
Source:
public synchronized DateFormat get() { DateFormat dateFormat = threadMap.get(Thread.currentThread()); if (dateFormat == null) { dateFormat = (DateFormat) templateFormat.clone(); threadMap.put(Thread.currentThread(), dateFormat); } return dateFormat; }

Target:
public DateFormat get() { DateFormat dateFormat = threadMap.get(Thread.currentThread()); if (dateFormat == null) { dateFormat = (DateFormat) templateFormat.clone(); threadMap.put(Thread.currentThread(), dateFormat); } return dateFormat; }
Source:
public void getListeningSockets() { ServerStatusManager ssm = mock(ServerStatusManager.class); Map<SocketAddress, ChannelInitializer<?>> initializers = new HashMap<>(); initializers.put( new InetSocketAddress(0), new ChannelInitializer<Channel>() { @Override protected void initChannel(Channel ch) }); ClientConnectionsShutdown ccs = new ClientConnectionsShutdown( new DefaultChannelGroup(GlobalEventExecutor.INSTANCE), GlobalEventExecutor.INSTANCE, null); EventLoopGroupMetrics elgm = new EventLoopGroupMetrics(Spectator.globalRegistry()); EventLoopConfig elc = new EventLoopConfig() { @Override public int eventLoopCount() { return 1; } @Override public int acceptorCount() { return 1; } }; Server s = new Server(ssm, initializers, ccs, elgm, elc); s.start( false); List<SocketAddress> addrs = s.getListeningAddresses(); assertEquals(1, addrs.size()); assertTrue(addrs.get(0) instanceof InetSocketAddress); assertNotEquals(((InetSocketAddress) addrs.get(0)).getPort(), 0); s.stop(); }

Target:
public void getListeningSockets() throws Exception { ServerStatusManager ssm = mock(ServerStatusManager.class); Map<SocketAddress, ChannelInitializer<?>> initializers = new HashMap<>(); ChannelInitializer<Channel> init = new ChannelInitializer<Channel>() { @Override protected void initChannel(Channel ch) }; initializers.put(new InetSocketAddress(0), init); initializers.put(new InetSocketAddress(InetAddress.getLocalHost(), 0), init); ClientConnectionsShutdown ccs = new ClientConnectionsShutdown( new DefaultChannelGroup(GlobalEventExecutor.INSTANCE), GlobalEventExecutor.INSTANCE, null); EventLoopGroupMetrics elgm = new EventLoopGroupMetrics(Spectator.globalRegistry()); EventLoopConfig elc = new EventLoopConfig() { @Override public int eventLoopCount() { return 1; } @Override public int acceptorCount() { return 1; } }; Server s = new Server(ssm, initializers, ccs, elgm, elc); s.start( false); List<SocketAddress> addrs = s.getListeningAddresses(); assertEquals(2, addrs.size()); assertTrue(addrs.get(0) instanceof InetSocketAddress); assertNotEquals(((InetSocketAddress) addrs.get(0)).getPort(), 0); assertTrue(addrs.get(1) instanceof InetSocketAddress); assertNotEquals(((InetSocketAddress) addrs.get(1)).getPort(), 0); s.stop(); }
Source:
public boolean removeMemberFromReplicaSet(MongoDBServer server) { BSONObject existingConfig = getReplicaSetConfig(); if (existingConfig == null) { LOG.warn("Couldn't load config for replica set."); return false; } BasicBSONObject newConfig = ReplicaSetConfig.fromExistingConfig(existingConfig) .remove(server) .build(); return reconfigureReplicaSet(newConfig); }

Target:
public boolean removeMemberFromReplicaSet(MongoDBServer server) { BSONObject existingConfig = getReplicaSetConfig(); if (existingConfig == null) { LOG.warn("Couldn't load existing config for replica set from {}. Server not removed.", getServerAddress(), server); return false; } BasicBSONObject newConfig = ReplicaSetConfig.fromExistingConfig(existingConfig) .remove(server) .build(); return reconfigureReplicaSet(newConfig); }
Source:
public void close() throws IOException { if (mCachedDataReader.deRef() > 0) { return; } try (LockResource lockResource = new LockResource(getLock(mBlockId).writeLock())) { if (mCachedDataReader.getRefCount() == 0) { BLOCK_READERS.remove(mBlockId); } } if (mCachedDataReader.getRefCount() == 0) { mCachedDataReader.close(); } }

Target:
public void close() throws IOException { if (mCachedDataReader.deRef() > 0) { return; } try (LockResource lockResource = new LockResource(getLock(mBlockId).writeLock())) { if (mCachedDataReader.getRefCount() == 0) { BLOCK_READERS.remove(mBlockId); mCachedDataReader.close(); } } }
Source:
static void resetDir() throws IOException { File f = new File("/tmp/" + System.getProperty("user.name")); VoltFile.recursivelyDelete(f); f.mkdirs(); }

Target:
public static void resetDir() throws IOException { File f = new File("/tmp/" + System.getProperty("user.name")); VoltFile.recursivelyDelete(f); f.mkdirs(); }
Source:
public static void removeStemTable(ETL etl) { Mapping<Table> mapping = etl.getTableToTableMapping(); List<Pair<Table, Table>> tablesMappingsToRemove = new ArrayList<>(); for (ItemToItemMap sourceToTargetMap : mapping.getSourceToTargetMaps()) { Table sourceTable = (Table) sourceToTargetMap.getSourceItem(); Table targetTable = (Table) sourceToTargetMap.getTargetItem(); if (sourceTable.isStem() || targetTable.isStem()) { tablesMappingsToRemove.add(new Pair<>(sourceTable, targetTable)); etl.getFieldToFieldMapping(sourceTable, targetTable).removeAllSourceToTargetMaps(); } } for (Pair<Table, Table> tableTablePair : tablesMappingsToRemove) { mapping.removeSourceToTargetMap(tableTablePair.getItem1(), tableTablePair.getItem2()); } Database sourceDatabase = etl.getSourceDatabase(); List<Table> newSourceTables = new ArrayList<>(); for (Table table : sourceDatabase.getTables()) { if (!table.isStem()) { newSourceTables.add(table); } } sourceDatabase.setTables(newSourceTables); Database targetDatabase = etl.getTargetDatabase(); List<Table> newTargetTables = new ArrayList<>(); for (Table table : targetDatabase.getTables()) { if (!table.isStem()) { newTargetTables.add(table); } } targetDatabase.setTables(newTargetTables); }

Target:
public static void removeStemTable(ETL etl) { Mapping<Table> mapping = etl.getTableToTableMapping(); List<Pair<Table, Table>> tablesMappingsToRemove = new ArrayList<>(); for (ItemToItemMap sourceToTargetMap : mapping.getSourceToTargetMaps()) { Table sourceTable = (Table) sourceToTargetMap.getSourceItem(); Table targetTable = (Table) sourceToTargetMap.getTargetItem(); if (sourceTable.isStem() || targetTable.isStem()) { tablesMappingsToRemove.add(new Pair<>(sourceTable, targetTable)); } } for (Pair<Table, Table> tableTablePair : tablesMappingsToRemove) { etl.getFieldToFieldMapping(tableTablePair.getItem1(), tableTablePair.getItem2()).removeAllSourceToTargetMaps(); mapping.removeSourceToTargetMap(tableTablePair.getItem1(), tableTablePair.getItem2()); } Database sourceDatabase = etl.getSourceDatabase(); List<Table> newSourceTables = new ArrayList<>(); for (Table table : sourceDatabase.getTables()) { if (!table.isStem()) { newSourceTables.add(table); } } sourceDatabase.setTables(newSourceTables); Database targetDatabase = etl.getTargetDatabase(); List<Table> newTargetTables = new ArrayList<>(); for (Table table : targetDatabase.getTables()) { if (!table.isStem()) { newTargetTables.add(table); } } targetDatabase.setTables(newTargetTables); }
Source:
public Map<String, LocalCacheStats> getStats() { Map<String, LocalCacheStats> stats = createHashMap(statistics.size()); for (Map.Entry<String, CacheStatisticsImpl> entry : statistics.entrySet()) { String cacheName = entry.getKey(); LocalCacheStatsImpl localCacheStats = new LocalCacheStatsImpl(entry.getValue()); CompletableFuture<CacheConfig> configFuture = configs.get(cacheName); if (configFuture.isDone()) { try { localCacheStats.setNativeMemoryUsed(configFuture.get().getInMemoryFormat() == NATIVE); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } } stats.put(cacheName, localCacheStats); } return stats; }

Target:
public Map<String, LocalCacheStats> getStats() { Map<String, LocalCacheStats> stats = createHashMap(statistics.size()); for (Map.Entry<String, CacheStatisticsImpl> entry : statistics.entrySet()) { String cacheName = entry.getKey(); LocalCacheStatsImpl localCacheStats = new LocalCacheStatsImpl(entry.getValue()); CompletableFuture<CacheConfig> configFuture = configs.get(cacheName); if (configFuture.isDone()) { try { localCacheStats.setInMemoryFormat(configFuture.get().getInMemoryFormat()); } catch (InterruptedException e) { logger.severe(e); Thread.currentThread().interrupt(); throw ExceptionUtil.rethrow(e); } catch (ExecutionException e) { } } stats.put(cacheName, localCacheStats); } return stats; }
Source:
public AzureBlobStore(RepositoryMetadata metadata, AzureStorageService service, ThreadPool threadPool) { this.container = Repository.CONTAINER_SETTING.get(metadata.settings()); this.clientName = Repository.CLIENT_NAME.get(metadata.settings()); this.service = service; this.threadPool = threadPool; this.locationMode = Repository.LOCATION_MODE_SETTING.get(metadata.settings()); final Map<String, AzureStorageSettings> prevSettings = this.service.refreshAndClearCache(emptyMap()); final Map<String, AzureStorageSettings> newSettings = AzureStorageSettings.overrideLocationMode(prevSettings, this.locationMode); this.service.refreshAndClearCache(newSettings); this.getMetricsCollector = (httpURLConnection) -> { if (httpURLConnection.getRequestMethod().equalsIgnoreCase("HEAD")) { stats.headOperations.incrementAndGet(); return; } stats.getOperations.incrementAndGet(); }; this.listMetricsCollector = (httpURLConnection) -> stats.listOperations.incrementAndGet(); this.uploadMetricsCollector = (httpURLConnection -> { assert httpURLConnection.getRequestMethod().equals("PUT"); String queryParams = httpURLConnection.getURL().getQuery(); if (queryParams != null && (queryParams.contains("comp=block") || queryParams.contains("comp=blocklist"))) { stats.putBlockOperations.incrementAndGet(); } else { stats.putOperations.incrementAndGet(); } }); }

Target:
public AzureBlobStore(RepositoryMetadata metadata, AzureStorageService service, ThreadPool threadPool) { this.container = Repository.CONTAINER_SETTING.get(metadata.settings()); this.clientName = Repository.CLIENT_NAME.get(metadata.settings()); this.service = service; this.threadPool = threadPool; this.locationMode = Repository.LOCATION_MODE_SETTING.get(metadata.settings()); final Map<String, AzureStorageSettings> prevSettings = this.service.refreshAndClearCache(emptyMap()); final Map<String, AzureStorageSettings> newSettings = AzureStorageSettings.overrideLocationMode(prevSettings, this.locationMode); this.service.refreshAndClearCache(newSettings); this.getMetricsCollector = (httpURLConnection) -> { if (httpURLConnection.getRequestMethod().equals("HEAD")) { stats.headOperations.incrementAndGet(); return; } assert httpURLConnection.getRequestMethod().equals("GET"); stats.getOperations.incrementAndGet(); }; this.listMetricsCollector = (httpURLConnection) -> { assert httpURLConnection.getRequestMethod().equals("GET"); stats.listOperations.incrementAndGet(); }; this.uploadMetricsCollector = (httpURLConnection -> { assert httpURLConnection.getRequestMethod().equals("PUT"); String queryParams = httpURLConnection.getURL().getQuery(); if (queryParams != null && isBlockUpload(queryParams)) { stats.putBlockOperations.incrementAndGet(); } else { stats.putOperations.incrementAndGet(); } }); }
Source:
private ArrayList<DataChangedEvent> getRenamedEvents(Set<IComponentNamePO> renamedCompNames) { ArrayList<DataChangedEvent> events = new ArrayList<DataChangedEvent>(); for (IComponentNamePO compName : renamedCompNames) { events.add(new DataChangedEvent(compName, DataState.Renamed, UpdateState.all)); } return events; }

Target:
private List<DataChangedEvent> getRenamedEvents(Set<IComponentNamePO> renamedCompNames) { List<DataChangedEvent> events = new ArrayList<DataChangedEvent>(); for (IComponentNamePO compName : renamedCompNames) { events.add(new DataChangedEvent(compName, DataState.Renamed, UpdateState.all)); } return events; }
Source:
public Snippet004HideSelection(Shell shell) { int style = SWT.BORDER | SWT.FULL_SELECTION; final TableViewer v = new TableViewer(shell, style); v.setLabelProvider(new LabelProvider()); v.setContentProvider(ArrayContentProvider.getInstance()); MyModel[] model = createModel(); v.setInput(model); v.getTable().setLinesVisible(true); v.getTable().addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { if (v.getTable().getItem(new Point(e.x, e.y)) == null) { v.setSelection(new StructuredSelection()); } } }); }

Target:
public Snippet004HideSelection(Shell shell) { final TableViewer v = new TableViewer(shell, SWT.BORDER | SWT.FULL_SELECTION); v.setLabelProvider(new LabelProvider()); v.setContentProvider(ArrayContentProvider.getInstance()); MyModel[] model = createModel(); v.setInput(model); v.getTable().setLinesVisible(true); v.getTable().addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { if (v.getTable().getItem(new Point(e.x, e.y)) == null) { v.setSelection(new StructuredSelection()); } } }); }
Source:
public List<NewsItem> fetchNews() { List<NewsItem> result = new ArrayList<>(); SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = noCatch(() -> input.build(new XmlReader(new URL(newsFeedUrl)))); for (SyndEntry syndEntry : feed.getEntries()) { String author = syndEntry.getAuthor(); String link = syndEntry.getLink(); String title = syndEntry.getTitle(); String content = syndEntry.getContents().get(0).getValue(); Date publishedDate = syndEntry.getPublishedDate(); NewsCategory newsCategory = NewsCategory.fromString(syndEntry.getCategories().get(0).getName()); result.add(new NewsItem(author, link, title, content, publishedDate, newsCategory)); } return result; }

Target:
public List<NewsItem> fetchNews() { List<NewsItem> result = new ArrayList<>(); SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = noCatch(() -> input.build(new XmlReader(new URL(newsFeedUrl)))); for (SyndEntry syndEntry : feed.getEntries()) { String author = syndEntry.getAuthor(); String link = syndEntry.getLink(); String title = syndEntry.getTitle(); String content = syndEntry.getContents().get(0).getValue(); Date publishedDate = syndEntry.getPublishedDate(); NewsCategory newsCategory = syndEntry.getCategories().stream() .filter(Objects::nonNull) .findFirst() .map(SyndCategory::getName) .map(NewsCategory::fromString) .orElse(NewsCategory.UNCATEGORIZED); result.add(new NewsItem(author, link, title, content, publishedDate, newsCategory)); } return result; }
Source:
@Ignore public void testJoinWithMergeProjectShouldParse() { final String sql = "WITH query as (select empno, deptno as deptno11, deptno as deptno12 from emp)\n" + "select query.deptno11, emp.deptno, query.deptno12\n" + "FROM query\n" + "JOIN emp ON (cast(query.empno as Integer) = cast(emp.empno as Integer))"; sql(sql).ok(); }

Target:
@Test public void testJoinWithMergeProjectShouldParse() { final String sql = "WITH query as " + " (select empno, deptno as deptno11, deptno as deptno12 from emp)\n" + "select query.deptno11, emp.deptno, query.deptno12\n" + "FROM query\n" + "JOIN emp ON (cast(query.empno as Integer) = cast(emp.empno as Integer))"; sql(sql).ok(); }
Source:
public void onConnected(Bundle connectionHint) { Log.d(TAG, "onConnected(): Connection successful"); setViewVisibility(); if (connectionHint != null) { mTurnBasedMatch = connectionHint.getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH); } if (mTurnBasedMatch != null) { if (mGoogleApiClient == null || !mGoogleApiClient.isConnected()) { Log.d(TAG, "Warning: accessing TurnBasedMatch when not connected"); } updateMatch(mTurnBasedMatch); return; } Games.Invitations.registerInvitationListener(mGoogleApiClient, this); Games.TurnBasedMultiplayer.registerMatchUpdateListener(mGoogleApiClient, this); }

Target:
public void onConnected(Bundle connectionHint) { Log.d(TAG, "onConnected(): Connection successful"); if (connectionHint != null) { mTurnBasedMatch = connectionHint.getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH); if (mTurnBasedMatch != null) { if (mGoogleApiClient == null || !mGoogleApiClient.isConnected()) { Log.d(TAG, "Warning: accessing TurnBasedMatch when not connected"); } updateMatch(mTurnBasedMatch); return; } } setViewVisibility(); Games.Invitations.registerInvitationListener(mGoogleApiClient, this); Games.TurnBasedMultiplayer.registerMatchUpdateListener(mGoogleApiClient, this); }
Source:
public void testGetExistingDocWithIDInBatch() throws CouchbaseLiteException { final int NUM_DOCS = 10; Database.getLog().getConsole().setLevel(LogLevel.VERBOSE); createDocs(NUM_DOCS); db.inBatch(new Runnable() { @Override public void run() { validateDocs(NUM_DOCS); } }); }

Target:
public void testGetExistingDocWithIDInBatch() throws CouchbaseLiteException { final int NUM_DOCS = 10; createDocs(NUM_DOCS); db.inBatch(new Runnable() { @Override public void run() { validateDocs(NUM_DOCS); } }); }
Source:
public void testCollapseExpandTreeRow() { SWTBotNatTable nattable = bot.nattable(); nattable.collaspeAll(new Position(1,1)); int count = nattable.preferredRowCount(); assertEquals("After collapse, 3 rows", 3, count); nattable.expandTreeRow(POSITION, 1); count = nattable.preferredRowCount(); assertEquals("After expandTreeRow, 16 rows", 16, count); nattable.expandAll(POSITION); count = nattable.preferredRowCount(); assertEquals("After expand, 49 rows", 49, count); nattable.collapseTreeRow(POSITION, 24); count = nattable.preferredRowCount(); assertEquals("After expand, 49 rows", 26, count); }

Target:
public void testCollapseExpandTreeRow() { SWTBotNatTable nattable = bot.nattable(); nattable.collapseAll(new Position(1,1)); int count = nattable.preferredRowCount(); assertEquals("After collapse, 3 rows", 3, count); nattable.expandTreeRow(POSITION, 1); count = nattable.preferredRowCount(); assertEquals("After expandTreeRow, 16 rows", 16, count); nattable.expandAll(POSITION); count = nattable.preferredRowCount(); assertEquals("After expand, 49 rows", 49, count); nattable.collapseTreeRow(POSITION, 24); count = nattable.preferredRowCount(); assertEquals("After expand, 26 rows", 26, count); }
Source:
public String getPropertyName(ExecutableElement getterOrSetterMethod) { String methodName = getterOrSetterMethod.getSimpleName().toString(); if ( isFluentSetter( getterOrSetterMethod ) ) { if ( ( methodName.startsWith( "get" ) || methodName.startsWith( "set" ) ) && methodName.length() > 3 && Character.isUpperCase( methodName.charAt( 3 ) ) ) { return IntrospectorUtils.decapitalize( methodName.substring( 3 ) ); } else { return methodName; } } return IntrospectorUtils.decapitalize( methodName.substring( methodName.startsWith( "is" ) ? 2 : 3 ) ); }

Target:
public String getPropertyName(ExecutableElement getterOrSetterMethod) { String methodName = getterOrSetterMethod.getSimpleName().toString(); if ( isFluentSetter( getterOrSetterMethod ) ) { if ( methodName.startsWith( "set" ) && methodName.length() > 3 && Character.isUpperCase( methodName.charAt( 3 ) ) ) { return IntrospectorUtils.decapitalize( methodName.substring( 3 ) ); } else { return methodName; } } return IntrospectorUtils.decapitalize( methodName.substring( methodName.startsWith( "is" ) ? 2 : 3 ) ); }
Source:
public void notifyServerCertificate(final Certificate serverCertificate) throws IOException { final JcaX509CertificateConverter converter = new JcaX509CertificateConverter().setProvider("BC"); final List<X509Certificate> x509Certs = Lists.newArrayList(); try { for (final org.bouncycastle.asn1.x509.Certificate cert : serverCertificate.getCertificateList()) { x509Certs.add(converter.getCertificate(new X509CertificateHolder(cert))); } } catch (CertificateException e) { throw Throwables.propagate(e); } serverCertificates = x509Certs.toArray(new X509Certificate[0]); }

Target:
public void notifyServerCertificate(final Certificate serverCertificate) throws IOException { final JcaX509CertificateConverter converter = new JcaX509CertificateConverter().setProvider("BC"); final List<X509Certificate> x509Certs = Lists.newArrayList(); try { for (final org.bouncycastle.asn1.x509.Certificate cert : serverCertificate.getCertificateList()) { x509Certs.add(converter.getCertificate(new X509CertificateHolder(cert))); } } catch (CertificateException e) { throw new IOException("couldn't convert the server certificate", e); } serverCertificates = x509Certs.toArray(new X509Certificate[0]); }
Source:
public EnvironmentDTO populate(ModelTranslator translator, Environment source, EnvironmentDTO dest) { if (source == null) { throw new IllegalArgumentException("source is null"); } if (dest == null) { throw new IllegalArgumentException("destination is null"); } Date created = source.getCreated(); dest.created(created != null ? created.toInstant().atOffset(ZoneOffset.UTC) : null); Date updated = source.getUpdated(); dest.updated(updated != null ? updated.toInstant().atOffset(ZoneOffset.UTC) : null); dest.id(source.getId()) .name(source.getName()) .description(source.getDescription()); if (translator != null) { Owner owner = source.getOwner(); dest.setOwner(owner != null ? translator.translate(owner, NestedOwnerDTO.class) : null); Set<EnvironmentContent> envContents = source.getEnvironmentContent(); if (envContents != null) { Set<EnvironmentContentDTO> setOfEnvironmentContents = new HashSet<>(); ObjectTranslator<Content, ContentDTO> contentTranslator = translator .findTranslatorByClass(Content.class, ContentDTO.class); for (EnvironmentContent ec : envContents) { if (ec != null) { ContentDTO dto = contentTranslator.translate(translator, ec.getContent()); if (dto != null) { setOfEnvironmentContents.add(new EnvironmentContentDTO() .content(dto) .enabled(ec.getEnabled())); } } } dest.setEnvironmentContent(setOfEnvironmentContents); } } else { dest.setOwner(null); dest.setEnvironmentContent(null); } return dest; }

Target:
public EnvironmentDTO populate(ModelTranslator translator, Environment source, EnvironmentDTO dest) { if (source == null) { throw new IllegalArgumentException("source is null"); } if (dest == null) { throw new IllegalArgumentException("destination is null"); } dest.created(Util.toDateTime(source.getCreated())) .updated(Util.toDateTime(source.getUpdated())) .id(source.getId()) .name(source.getName()) .description(source.getDescription()); if (translator != null) { Owner owner = source.getOwner(); dest.setOwner(owner != null ? translator.translate(owner, NestedOwnerDTO.class) : null); Set<EnvironmentContent> envContents = source.getEnvironmentContent(); if (envContents != null) { Set<EnvironmentContentDTO> setOfEnvironmentContents = new HashSet<>(); ObjectTranslator<Content, ContentDTO> contentTranslator = translator .findTranslatorByClass(Content.class, ContentDTO.class); for (EnvironmentContent ec : envContents) { if (ec != null) { ContentDTO dto = contentTranslator.translate(translator, ec.getContent()); if (dto != null) { setOfEnvironmentContents.add(new EnvironmentContentDTO() .content(dto) .enabled(ec.getEnabled())); } } } dest.setEnvironmentContent(setOfEnvironmentContents); } } else { dest.setOwner(null); dest.setEnvironmentContent(null); } return dest; }
Source:
private String buildCredentialScope(String dateWithoutTimeStamp) { StringBuilder buffer = new StringBuilder(); buffer.append(dateWithoutTimeStamp).append("/"); buffer.append(REGION).append("/"); buffer.append(SERVICE).append("/"); buffer.append(TERMINATION_STRING); return buffer.toString(); }

Target:
private static String buildCredentialScope(String dateWithoutTimeStamp) { return dateWithoutTimeStamp + "/" + REGION + "/" + SERVICE + "/" + TERMINATION_STRING; }
Source:
private int getNumDaysInMonth(Calendar cal){ int totalDays = cal.getActualMaximum(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, 1); int monthStartWeekDay = cal.get(Calendar.DAY_OF_WEEK) - 1; int daysSincePreviousSunday = -monthStartWeekDay; totalDays += monthStartWeekDay; cal.add(Calendar.DAY_OF_MONTH, daysSincePreviousSunday); return totalDays; }

Target:
private static int getNumDaysInMonth(Calendar cal){ int totalDays = cal.getActualMaximum(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, 1); int monthStartWeekDay = cal.get(Calendar.DAY_OF_WEEK) - 1; int daysSincePreviousSunday = -monthStartWeekDay; totalDays += monthStartWeekDay; cal.add(Calendar.DAY_OF_MONTH, daysSincePreviousSunday); return totalDays; }
Source:
public boolean removeAll(Collection<?> c) { boolean removedSomething = false; for (Object removeMe : c) { removedSomething |= remove(removeMe); } return removedSomething; }

Target:
public boolean removeAll(Collection<?> c) { boolean removedSomething = false; for (Object key : c) { removedSomething |= remove(key); } return removedSomething; }
Source:
public void testPropertiesMarshallUnmarshall() throws Exception { XmlMarshallUnmarshallImpl xmlMarshallerImpl = new XmlMarshallUnmarshallImpl(); String pid = "org.eclipse.kura.cloud.CloudService"; Tocd definition = null; Map<String, Object> properties = new HashMap<>(); properties.put("prop.string", new String("prop.value")); properties.put("prop.long", Long.MAX_VALUE); properties.put("prop.double", Double.MAX_VALUE); properties.put("prop.float", Float.MAX_VALUE); properties.put("prop.integer", Integer.MAX_VALUE); properties.put("prop.byte", Byte.MAX_VALUE); properties.put("prop.character", 'a'); properties.put("prop.short", Short.MAX_VALUE); XmlComponentConfigurations xcc = new XmlComponentConfigurations(); List<ComponentConfiguration> ccis = new ArrayList<>(); ComponentConfigurationImpl config = new ComponentConfigurationImpl(pid, definition, properties); ccis.add(config); xcc.setConfigurations(ccis); String s = xmlMarshallerImpl.marshal(xcc); System.err.println(s); XmlComponentConfigurations config1 = xmlMarshallerImpl.unmarshal(s, XmlComponentConfigurations.class); String s1 = xmlMarshallerImpl.marshal(config1); System.err.println(s1); Map<String, Object> properties1 = config1.getConfigurations().get(0).getConfigurationProperties(); assertEquals(properties, properties1); }

Target:
public void testPropertiesMarshallUnmarshall() throws Exception { XmlMarshallUnmarshallImpl xmlMarshallerImpl = new XmlMarshallUnmarshallImpl(); String pid = "org.eclipse.kura.cloud.CloudService"; Tocd definition = null; Map<String, Object> properties = new HashMap<>(); properties.put("prop.string", new String("prop.value")); properties.put("prop.long", Long.MAX_VALUE); properties.put("prop.double", Double.MAX_VALUE); properties.put("prop.float", Float.MAX_VALUE); properties.put("prop.integer", Integer.MAX_VALUE); properties.put("prop.byte", Byte.MAX_VALUE); properties.put("prop.character", 'a'); properties.put("prop.short", Short.MAX_VALUE); XmlComponentConfigurations xcc = new XmlComponentConfigurations(); List<ComponentConfiguration> ccis = new ArrayList<>(); ComponentConfigurationImpl config = new ComponentConfigurationImpl(pid, definition, properties); ccis.add(config); xcc.setConfigurations(ccis); String s = xmlMarshallerImpl.marshal(xcc); logger.info(s); XmlComponentConfigurations config1 = xmlMarshallerImpl.unmarshal(s, XmlComponentConfigurations.class); String s1 = xmlMarshallerImpl.marshal(config1); logger.info(s1); Map<String, Object> properties1 = config1.getConfigurations().get(0).getConfigurationProperties(); assertEquals(properties, properties1); }