auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private List<Integer> getAlleles(final int PLIndex) { while(PLIndex >= allelesList.size()) { final List<Integer> nextPLs; final int alleleToIncrement; if (alleleToIncrementForNextIndex < 0) { alleleToIncrement = availableAllelesToIncrementDeque.isEmpty() ? ploidy - 1 : availableAllelesToIncrementDeque.pollLast(); nextPLs = new ArrayList<>(Collections.nCopies(alleleToIncrement, 0)); nextPLs.addAll(allelesList.get(allelesList.size() - 1).subList(alleleToIncrement, ploidy)); } else { alleleToIncrement = alleleToIncrementForNextIndex; nextPLs = new ArrayList<>(allelesList.get(allelesList.size() - 1)); } final int incrementedValue = nextPLs.get(alleleToIncrement) + 1; nextPLs.set(alleleToIncrement, incrementedValue); alleleToIncrementForNextIndex = alleleToIncrement - 1; if (alleleToIncrement < ploidy - 1 && nextPLs.get(alleleToIncrement) < nextPLs.get(alleleToIncrement + 1)) { availableAllelesToIncrementDeque.add(alleleToIncrement); } allelesList.add(nextPLs); } return allelesList.get(PLIndex); }

Target:
private List<Integer> getAlleles(final int PLIndex) { while(PLIndex >= allelesList.size()) { final List<Integer> nextPLs; final int alleleToIncrement; if (alleleToIncrementForNextIndex < 0) { alleleToIncrement = availableAllelesToIncrementDeque.isEmpty() ? ploidy - 1 : availableAllelesToIncrementDeque.removeLast(); nextPLs = new ArrayList<>(Collections.nCopies(alleleToIncrement, 0)); nextPLs.addAll(allelesList.get(allelesList.size() - 1).subList(alleleToIncrement, ploidy)); } else { alleleToIncrement = alleleToIncrementForNextIndex; nextPLs = new ArrayList<>(allelesList.get(allelesList.size() - 1)); } final int incrementedValue = nextPLs.get(alleleToIncrement) + 1; nextPLs.set(alleleToIncrement, incrementedValue); alleleToIncrementForNextIndex = alleleToIncrement - 1; if (alleleToIncrement < ploidy - 1 && nextPLs.get(alleleToIncrement) < nextPLs.get(alleleToIncrement + 1)) { availableAllelesToIncrementDeque.add(alleleToIncrement); } allelesList.add(nextPLs); } return allelesList.get(PLIndex); }
Source:
public void testReplaceVariableWithTTLAndScheduleRestart() { EasyMock.expect(worker.herder()).andReturn(herder); EasyMock.expect(herder.restartConnector(eq(1L), eq(MY_CONNECTOR), anyObject())).andReturn(requestId); replayAll(); Map<String, String> result = configTransformer.transform(MY_CONNECTOR, Collections.singletonMap(MY_KEY, "${test:testPath:testKeyWithTTL}")); assertEquals(TEST_RESULT_WITH_TTL, result.get(MY_KEY)); }

Target:
public void testReplaceVariableWithTTLAndScheduleRestart() { EasyMock.expect(worker.herder()).andReturn(herder); EasyMock.expect(herder.restartConnector(eq(1L), eq(MY_CONNECTOR), notNull())).andReturn(requestId); replayAll(); Map<String, String> result = configTransformer.transform(MY_CONNECTOR, Collections.singletonMap(MY_KEY, "${test:testPath:testKeyWithTTL}")); assertEquals(TEST_RESULT_WITH_TTL, result.get(MY_KEY)); }
Source:
public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) { if (bridgeStatusInfo.getStatus() == ThingStatus.OFFLINE) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); stop(); connection = null; return; } if (bridgeStatusInfo.getStatus() != ThingStatus.ONLINE) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); stop(); return; } AbstractBrokerHandler h = getBridgeHandler(); if (h == null) { logger.warn("Bridge handler not found!"); return; } this.connection = h.getConnection(); MqttBrokerConnection connection = this.connection; if (connection == null) { logger.warn("Bridge handler has no valid broker connection!"); return; } try { start(connection).thenApply(e -> true).exceptionally(e -> { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getLocalizedMessage()); return null; }).get(subscribeTimeout, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException ignored) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Did not receive all required topics"); } }

Target:
public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) { if (bridgeStatusInfo.getStatus() == ThingStatus.OFFLINE) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); stop(); connection = null; return; } if (bridgeStatusInfo.getStatus() != ThingStatus.ONLINE) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); stop(); return; } AbstractBrokerHandler h = getBridgeHandler(); if (h == null) { logger.warn("Bridge handler not found!"); return; } final MqttBrokerConnection connection; try { connection = h.getConnectionAsync().get(500, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException ignored) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_UNINITIALIZED, "Bridge handler has no valid broker connection!"); return; } this.connection = connection; try { start(connection).thenApply(e -> true).exceptionally(e -> { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getLocalizedMessage()); return null; }).get(subscribeTimeout, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException ignored) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Did not receive all required topics"); } }
Source:
public void onActivityPaused(Activity activity) { if (null != mCurInAppNotification) { mCurInAppNotification.dismiss(); } }

Target:
public void onActivityPaused(Activity activity)
Source:
public boolean skip(String id, ESObjectContainer<ModelElementId> collection) { if (id.contains(ID_SUFFIX)) { final String containerId = id.substring(0, id.lastIndexOf(SEPARATOR)); final ModelElementId containerModelElementId = ModelFactory.eINSTANCE.createModelElementId(); containerModelElementId.setId(containerId); return collection.contains(containerModelElementId); } return false; }

Target:
public boolean skip(String id, ESObjectContainer<ModelElementId> collection) { if (id.endsWith(ID_SUFFIX)) { final String containerId = id.substring(0, id.lastIndexOf(SEPARATOR)); final ModelElementId containerModelElementId = ModelFactory.eINSTANCE.createModelElementId(); containerModelElementId.setId(containerId); return collection.contains(containerModelElementId); } return false; }
Source:
public static PathValue path( NodeValue[] nodes, EdgeValue[] edges ) { assert nodes != null; assert edges != null; if ( nodes.length + edges.length % 2 == 0 ) { throw new IllegalArgumentException( "Tried to construct a path that is not built like a path: even number of elements" ); } return new PathValue( nodes, edges ); }

Target:
public static PathValue path( NodeValue[] nodes, EdgeValue[] edges ) { assert nodes != null; assert edges != null; if ( (nodes.length + edges.length) % 2 == 0 ) { throw new IllegalArgumentException( "Tried to construct a path that is not built like a path: even number of elements" ); } return new PathValue( nodes, edges ); }
Source:
public void writeLac(final BookieSocketAddress addr, final long ledgerId, final byte[] masterKey, final long lac, final ByteBufList toSend, final WriteLacCallback cb, final Object ctx) { final PerChannelBookieClientPool client = lookupClient(addr); if (client == null) { cb.writeLacComplete(getRc(BKException.Code.BookieHandleNotAvailableException), ledgerId, addr, ctx); return; } toSend.retain(); client.obtain(new GenericCallback<PerChannelBookieClient>() { @Override public void operationComplete(final int rc, PerChannelBookieClient pcbc) { if (rc != BKException.Code.OK) { try { executor.submitOrdered(ledgerId, new SafeRunnable() { @Override public void safeRun() { cb.writeLacComplete(rc, ledgerId, addr, ctx); } }); } catch (RejectedExecutionException re) { cb.writeLacComplete(getRc(BKException.Code.InterruptedException), ledgerId, addr, ctx); } } else { pcbc.writeLac(ledgerId, masterKey, lac, toSend, cb, ctx); } toSend.release(); } }, ledgerId); }

Target:
public void writeLac(final BookieSocketAddress addr, final long ledgerId, final byte[] masterKey, final long lac, final ByteBufList toSend, final WriteLacCallback cb, final Object ctx) { final PerChannelBookieClientPool client = lookupClient(addr); if (client == null) { cb.writeLacComplete(getRc(BKException.Code.BookieHandleNotAvailableException), ledgerId, addr, ctx); return; } toSend.retain(); client.obtain((rc, pcbc) -> { if (rc != BKException.Code.OK) { try { executor.submitOrdered(ledgerId, safeRun(() -> { cb.writeLacComplete(rc, ledgerId, addr, ctx); })); } catch (RejectedExecutionException re) { cb.writeLacComplete(getRc(BKException.Code.InterruptedException), ledgerId, addr, ctx); } } else { pcbc.writeLac(ledgerId, masterKey, lac, toSend, cb, ctx); } toSend.release(); }, ledgerId); }
Source:
public String toString() { String str = "ErrorReport{code=" + code; if (message != null) { str = str.concat(", message='" + message + "'"); } else { str = str.concat(", description='" + description + "'"); str = str.concat(", parameter='" + parameter + "'"); } str = str.concat("}"); return str; }

Target:
public String toString() { String str = "ErrorReport{code=" + code; if (message != null && !message.isEmpty()) { str = str.concat(", message='" + message + "'"); } else { str = str.concat(", description='" + description + "'"); str = str.concat(", parameter='" + parameter + "'"); } str = str.concat("}"); return str; }
Source:
public TaskVariableDeleteBuilder dateRangeStart(Date rangeStart) { if (checkIfNull(rangeStart)) { return this; } addRangeParameter(TASK_VARIABLE_DATE_ID_LIST, "created on date range end", ensureDateNotTimestamp(rangeStart)[0], true); return this; }

Target:
public TaskVariableDeleteBuilder dateRangeStart(Date rangeStart) { if (checkIfNull(rangeStart)) { return this; } addRangeParameter(TASK_VARIABLE_DATE_ID_LIST, "created on date range start", ensureDateNotTimestamp(rangeStart)[0], true); return this; }
Source:
private static void upgradeMap(final Map<IMember, Set<IMember>> result, final Map<IMember, Set<IMember>> map) { for (Entry<IMember, Set<IMember>> entry : map.entrySet()) { final IMember key= entry.getKey(); if (!result.containsKey(key)) { final Set<IMember> mapSet= map.get(key); final Set<IMember> resultSet= new HashSet<>(mapSet); result.put(key, resultSet); } } }

Target:
private static void upgradeMap(final Map<IMember, Set<IMember>> result, final Map<IMember, Set<IMember>> map) { for (Entry<IMember, Set<IMember>> entry : map.entrySet()) { final IMember key= entry.getKey(); if (!result.containsKey(key)) { final Set<IMember> mapSet= entry.getValue(); final Set<IMember> resultSet= new HashSet<>(mapSet); result.put(key, resultSet); } } }
Source:
public void close() { Throwable thrown = null; for (MappedByteBuffer mappedByteBuffer : buffersList) { if (mappedByteBuffer == null) { continue; } try { ByteBufferUtils.unmap(mappedByteBuffer); } catch (Throwable t) { if (thrown == null) { thrown = t; } else { thrown.addSuppressed(t); } } } buffersList.clear(); Throwables.propagateIfPossible(thrown); }

Target:
public void close() { Throwable thrown = null; for (MappedByteBuffer mappedByteBuffer : buffersList) { if (mappedByteBuffer == null) { continue; } try { ByteBufferUtils.unmap(mappedByteBuffer); } catch (Throwable t) { if (thrown == null) { thrown = t; } else { thrown.addSuppressed(t); } } } buffersList.clear(); if (thrown != null) { throw new RuntimeException(thrown); } }
Source:
public DimensionsSpec( @JsonProperty("dimensions") List<DimensionSchema> dimensions, @JsonProperty("dimensionExclusions") List<String> dimensionExclusions, @Deprecated @JsonProperty("spatialDimensions") List<SpatialDimensionSchema> spatialDimensions ) { this.dimensions = dimensions == null ? Lists.<DimensionSchema>newArrayList() : Lists.newArrayList(dimensions); this.dimensionExclusions = (dimensionExclusions == null) ? Sets.<String>newHashSet() : Sets.newHashSet(dimensionExclusions); this.spatialDimensions = (spatialDimensions == null) ? Lists.<SpatialDimensionSchema>newArrayList() : spatialDimensions; verify(); this.dimensionSchemaMap = new HashMap<>(); for (DimensionSchema schema : this.dimensions) { dimensionSchemaMap.put(schema.getName(), schema); } for(SpatialDimensionSchema spatialSchema : this.spatialDimensions) { DimensionSchema newSchema = DimensionsSpec.convertSpatialSchema(spatialSchema); this.dimensions.add(newSchema); dimensionSchemaMap.put(newSchema.getName(), newSchema); } this.spatialDimensions = null; }

Target:
public DimensionsSpec( @JsonProperty("dimensions") List<DimensionSchema> dimensions, @JsonProperty("dimensionExclusions") List<String> dimensionExclusions, @Deprecated @JsonProperty("spatialDimensions") List<SpatialDimensionSchema> spatialDimensions ) { this.dimensions = dimensions == null ? Lists.<DimensionSchema>newArrayList() : Lists.newArrayList(dimensions); this.dimensionExclusions = (dimensionExclusions == null) ? Sets.<String>newHashSet() : Sets.newHashSet(dimensionExclusions); List<SpatialDimensionSchema> spatialDims = (spatialDimensions == null) ? Lists.<SpatialDimensionSchema>newArrayList() : spatialDimensions; verify(spatialDims); this.dimensionSchemaMap = new HashMap<>(); for (DimensionSchema schema : this.dimensions) { dimensionSchemaMap.put(schema.getName(), schema); } for(SpatialDimensionSchema spatialSchema : spatialDims) { DimensionSchema newSchema = DimensionsSpec.convertSpatialSchema(spatialSchema); this.dimensions.add(newSchema); dimensionSchemaMap.put(newSchema.getName(), newSchema); } }
Source:
public IStatus unloadAtResourceSetDispose(Resource resource, IProgressMonitor monitor) { TreeIterator<EObject> allContents = resource.getAllContents(); while (allContents.hasNext()) { EObject eObject = allContents.next(); eObject.eAdapters().clear(); } return new Status(IStatus.INFO, SiriusPlugin.ID, ""); }

Target:
public IStatus unloadAtResourceSetDispose(Resource resource, IProgressMonitor monitor) { if (!isFromPackageRegistry(resource)) { TreeIterator<EObject> allContents = EcoreUtil.getAllProperContents(resource, false); while (allContents.hasNext()) { EObject eObject = allContents.next(); eObject.eAdapters().clear(); } } return new Status(IStatus.INFO, SiriusPlugin.ID, ""); }
Source:
private CreateVolumeVDSCommandParameters getCreateVDSCommandParameters() { CreateVolumeVDSCommandParameters parameters = new CreateVolumeVDSCommandParameters(getStoragePoolId(), getDestinationStorageDomainId(), getImageGroupId(), getImage().getImageId(), getDiskImage().getSize(), newDiskImage.getVolumeType(), newDiskImage.getVolumeFormat(), getDiskImage().getId(), getDestinationImageId(), "", getStoragePool().getCompatibilityVersion(), getDiskImage().getContentType()); if (getStorageDomain().getStorageType().isBlockDomain()) { parameters.setImageInitialSizeInBytes(newDiskImage.getActualSizeInBytes()); } return parameters; }

Target:
private CreateVolumeVDSCommandParameters getCreateVDSCommandParameters() { CreateVolumeVDSCommandParameters parameters = new CreateVolumeVDSCommandParameters(getStoragePoolId(), getDestinationStorageDomainId(), getImageGroupId(), getImage().getImageId(), getDiskImage().getSize(), newDiskImage.getVolumeType(), newDiskImage.getVolumeFormat(), getDiskImage().getId(), getDestinationImageId(), "", getStoragePool().getCompatibilityVersion(), getDiskImage().getContentType()); parameters.setImageInitialSizeInBytes(newDiskImage.getActualSizeInBytes()); return parameters; }
Source:
public void checkSpecificAccessControl() { if (!userInfo.isInstructor && !userInfo.isAdmin) { throw new UnauthorizedAccessException("Instructor or Admin privilege is required to access this resource."); } String entity = getNonNullRequestParamValue(Const.ParamsNames.ENTITY_TYPE); if (!userInfo.isAdmin && "admin".equals(entity)) { throw new UnauthorizedAccessException("Admin privilege is required to access this resource."); } if (!userInfo.isInstructor && "instructor".equals(entity)) { throw new UnauthorizedAccessException("Instructor privilege is required to access this resource."); } }

Target:
public void checkSpecificAccessControl() { if (!userInfo.isInstructor && !userInfo.isAdmin) { throw new UnauthorizedAccessException("Instructor or Admin privilege is required to access this resource."); } }
Source:
protected Request send(Request request, Endpoint outEndpoint) { OSCoreEndpoint ep = (OSCoreEndpoint) outEndpoint; request.getOptions().setOscore(new byte[0]); ep.sendRequest(request); return request; }

Target:
protected Request send(Request request, Endpoint outEndpoint) { OSCoreEndpoint ep = (OSCoreEndpoint) outEndpoint; request.getOptions().setOscore(EMPTY); ep.sendRequest(request); return request; }
Source:
protected JsonObject doBuild(ElasticsearchSearchPredicateContext context, JsonObject outerObject, JsonObject innerObject) { context.explicitNested(); PATH_ACCESSOR.set( innerObject, absoluteFieldPath ); QUERY_ACCESSOR.set( innerObject, nestedBuilder.build( context ) ); outerObject.add( "nested", innerObject ); return outerObject; }

Target:
protected JsonObject doBuild(ElasticsearchSearchPredicateContext context, JsonObject outerObject, JsonObject innerObject) { ElasticsearchSearchPredicateContext nestedContext = context.explicitNested( absoluteFieldPath ); PATH_ACCESSOR.set( innerObject, absoluteFieldPath ); QUERY_ACCESSOR.set( innerObject, nestedBuilder.build( nestedContext ) ); outerObject.add( "nested", innerObject ); return outerObject; }
Source:
public byte[] toBytes() { ByteBuffer idBuf = ByteBuffer.allocate(sizeInBytes()); idBuf.putShort(version); switch (version) { case BLOB_ID_V1: break; case BLOB_ID_V2: case BLOB_ID_V3: idBuf.put((byte)(type.ordinal())); idBuf.put(datacenterId); idBuf.putShort(accountId); idBuf.putShort(containerId); break; default: throw new IllegalArgumentException("blobId version=" + version + " not supported"); } idBuf.put(partitionId.getBytes()); idBuf.putInt(uuid.getBytes().length); idBuf.put(uuid.getBytes()); return idBuf.array(); }

Target:
public byte[] toBytes() { ByteBuffer idBuf = ByteBuffer.allocate(sizeInBytes()); idBuf.putShort(version); switch (version) { case BLOB_ID_V1: break; case BLOB_ID_V2: case BLOB_ID_V3: idBuf.put((byte) (type.ordinal() & 0x3)); idBuf.put(datacenterId); idBuf.putShort(accountId); idBuf.putShort(containerId); break; default: throw new IllegalArgumentException("blobId version=" + version + " not supported"); } idBuf.put(partitionId.getBytes()); idBuf.putInt(uuid.getBytes().length); idBuf.put(uuid.getBytes()); return idBuf.array(); }
Source:
private void setHeaders(ArtifactInputStream ais, HttpServletResponse response, RepositoryFileAttributes fileAttributes, String path) throws IOException { response.setHeader("Accept-Ranges", "bytes"); long totalBytes = 0L; int readLength; byte[] bytes = new byte[4096]; while ((readLength = ais.read(bytes, 0, bytes.length)) != -1) { totalBytes += readLength; } response.setHeader("Content-Length", Long.toString(totalBytes)); response.setHeader("Last-Updated",fileAttributes.lastModifiedTime().toString()); ArtifactControllerHelper.setHeadersForChecksums(ais, response); setMediaTypeHeader(path, response); }

Target:
private void setHeaders(ArtifactInputStream ais, HttpServletResponse response, RepositoryFileAttributes fileAttributes, String path) throws IOException { response.setHeader("Accept-Ranges", "bytes"); if(!response.containsHeader("Content-Length")) { long totalBytes = 0L; int readLength; byte[] bytes = new byte[4096]; while ((readLength = ais.read(bytes, 0, bytes.length)) != -1) { totalBytes += readLength; } response.setHeader("Content-Length", Long.toString(totalBytes)); } response.setHeader("Last-Updated",fileAttributes.lastModifiedTime().toString()); ArtifactControllerHelper.setHeadersForChecksums(ais, response); setMediaTypeHeader(path, response); }
Source:
public PasteDescription createPasteDescription() { PasteDescriptionImpl pasteDescription = new PasteDescriptionImpl(); return pasteDescription; }

Target:
public PasteDescription createPasteDescription() { PasteDescriptionImpl pasteDescription = new PasteDescriptionSpec(); ContainerViewVariable newViewContainer = createContainerViewVariable(); newViewContainer.setName(IInterpreterSiriusVariables.CONTAINER_VIEW); DropContainerVariable newContainer = createDropContainerVariable(); newContainer.setName(IInterpreterSiriusVariables.CONTAINER); ElementVariable copiedElement = createElementVariable(); copiedElement.setName(IInterpreterSiriusVariables.COPIED_ELEMENT); ElementViewVariable copiedView = createElementViewVariable(); copiedView.setName(IInterpreterSiriusVariables.COPIED_VIEW); pasteDescription.setCopiedElement(copiedElement); pasteDescription.setCopiedView(copiedView); pasteDescription.setContainer(newContainer); pasteDescription.setContainerView(newViewContainer); pasteDescription.setInitialOperation(createInitialOperation()); pasteDescription.setForceRefresh(true); return pasteDescription; }
Source:
protected void setFetchTaskAttributes(Map attributeMap) { this.artifactId = (String) attributeMap.get(ARTIFACT_ID); if (StringUtils.isBlank(this.artifactId)) { return; } String pluginId = (String) attributeMap.get("pluginId"); if (StringUtils.isBlank(pluginId)) { return; } ArtifactPluginInfo artifactPluginInfo = getArtifactPluginInfo(pluginId); if (artifactPluginInfo == null) { return; } for (PluginConfiguration pluginConfiguration : artifactPluginInfo.getFetchArtifactSettings().getConfigurations()) { String key = pluginConfiguration.getKey(); if (attributeMap.containsKey(key)) { if (configuration.getProperty(key) == null) { configuration.addNewConfiguration(pluginConfiguration.getKey(), pluginConfiguration.isSecure()); } configuration.getProperty(key).setConfigurationValue(new ConfigurationValue((String) attributeMap.get(key))); configuration.getProperty(key).handleSecureValueConfiguration(pluginConfiguration.isSecure()); } } }

Target:
protected void setFetchTaskAttributes(Map attributeMap) { this.artifactId = (String) attributeMap.get(ARTIFACT_ID); if (StringUtils.isBlank(this.artifactId)) { return; } final Map<String, Object> userSpecifiedConfiguration = (Map<String, Object>) attributeMap.get(CONFIGURATION); if (userSpecifiedConfiguration == null) { return; } final String pluginId = (String) attributeMap.get("pluginId"); if (StringUtils.isBlank(pluginId)) { for (String key : userSpecifiedConfiguration.keySet()) { Map<String, String> configurationMetadata = (Map<String, String>) userSpecifiedConfiguration.get(key); if (configurationMetadata != null) { boolean isSecure = Boolean.parseBoolean(configurationMetadata.get("isSecure")); if (configuration.getProperty(key) == null) { configuration.addNewConfiguration(key, isSecure); } if (isSecure) { configuration.getProperty(key).setEncryptedValue(new EncryptedConfigurationValue(configurationMetadata.get("value"))); } else { configuration.getProperty(key).setConfigurationValue(new ConfigurationValue(configurationMetadata.get("value"))); } } } } else { for (Map.Entry<String, Object> configuration : userSpecifiedConfiguration.entrySet()) { this.configuration.addNewConfigurationWithValue(configuration.getKey(), String.valueOf(configuration.getValue()), false); } } }
Source:
public void onCreate() { super.onCreate(); TriggerReceiver.register(this); database = new GcmDatabase(this); heartbeatIntent = PendingIntent.getService(this, 0, new Intent(ACTION_HEARTBEAT, null, this, McsService.class), 0); alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); powerManager = (PowerManager) getSystemService(POWER_SERVICE); if(mDeviceIdleController == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { try { java.lang.reflect.Method method = Class.forName("android.os.ServiceManager").getMethod("getService", String.class); java.lang.reflect.Field field = Context.class.getField("DEVICE_IDLE_CONTROLLER"); IBinder binder = (IBinder) method.invoke(null, field.get(null)); if(binder != null) mDeviceIdleController = IDeviceIdleController.Stub.asInterface(binder); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (java.lang.reflect.InvocationTargetException e) { e.printStackTrace(); } } synchronized (McsService.class) { if (handlerThread == null) { handlerThread = new HandlerThread(); handlerThread.start(); } } }

Target:
public void onCreate() { super.onCreate(); TriggerReceiver.register(this); database = new GcmDatabase(this); heartbeatIntent = PendingIntent.getService(this, 0, new Intent(ACTION_HEARTBEAT, null, this, McsService.class), 0); alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); powerManager = (PowerManager) getSystemService(POWER_SERVICE); synchronized (McsService.class) { if (handlerThread == null) { handlerThread = new HandlerThread(); handlerThread.start(); } } }
Source:
private static void setCode(Node attrNode, CeType ce, String codeId) { if (attrNode.getNodeName().equalsIgnoreCase(NhincConstants.CE_CODE_ID)) { ce.setCode(attrNode.getNodeValue()); if (LOG.isTraceEnabled()) { LOG.trace(codeId + ": ce.Code = " + ce.getCode()); } } if (attrNode.getNodeName().equalsIgnoreCase(NhincConstants.CE_CODESYS_ID)) { ce.setCodeSystem(attrNode.getNodeValue()); if (LOG.isTraceEnabled()) { LOG.trace(codeId + ": ce.CodeSystem = " + ce.getCodeSystem()); } } if (attrNode.getNodeName().equalsIgnoreCase(NhincConstants.CE_CODESYSNAME_ID)) { ce.setCodeSystemName(attrNode.getNodeValue()); if (LOG.isTraceEnabled()) { LOG.trace(codeId + ": ce.CodeSystemName = " + ce.getCodeSystemName()); } } if (attrNode.getNodeName().equalsIgnoreCase(NhincConstants.CE_DISPLAYNAME_ID)) { ce.setDisplayName(attrNode.getNodeValue()); if (LOG.isTraceEnabled()) { LOG.trace(codeId + ": ce.DisplayName = " + ce.getDisplayName()); } } }

Target:
private static void setCode(Node attrNode, CeType ce, String codeId) { String nodeName = attrNode.getNodeName(); if (NhincConstants.CE_CODE_ID.equalsIgnoreCase(nodeName)) { ce.setCode(attrNode.getNodeValue()); LOG.trace("{}: ce.Code = {}", codeId, ce.getCode()); } if (NhincConstants.CE_CODESYS_ID.equalsIgnoreCase(nodeName)) { ce.setCodeSystem(attrNode.getNodeValue()); LOG.trace("{}: ce.CodeSystem = {}", codeId, ce.getCodeSystem()); } if (NhincConstants.CE_CODESYSNAME_ID.equalsIgnoreCase(nodeName)) { ce.setCodeSystemName(attrNode.getNodeValue()); LOG.trace("{}: ce.CodeSystemName = {}", codeId, ce.getCodeSystemName()); } if (NhincConstants.CE_DISPLAYNAME_ID.equalsIgnoreCase(nodeName)) { ce.setDisplayName(attrNode.getNodeValue()); LOG.trace("{}: ce.DisplayName = {}", codeId, ce.getDisplayName()); } }
Source:
public void findAllSCC(BitSet exception) { ISet nodes = graph.getNodes(); for (int i = 0; i < n; i++) { if (!exception.get(i)) { restriction.set(i, nodes.contains(i)); } } findAllSCCOf(restriction); }

Target:
public void findAllSCC(BitSet exception) { ISet nodes = graph.getNodes(); for (int i = exception.nextClearBit(0); i >= 0 && i < n; i = exception.nextClearBit(i + 1)) { restriction.set(i, nodes.contains(i)); } findAllSCCOf(restriction); }
Source:
public NettyHttpRequestWrapper(HttpRequest httpRequest) { checkNotNull(httpRequest); this.httpRequest = httpRequest; }

Target:
public NettyHttpRequestWrapper(HttpRequest httpRequest) { this.httpRequest = checkNotNull(httpRequest); }
Source:
private String getHtmlBegin() { return "<!DOCTYPE html>\n" + "<html>\n" + "<head>\n" + "<meta charset=\"UTF-8\">\n" + "<title>sampleFile - OpenGrok cross reference" + " for /sampleFile</title></head><body>\n"; }

Target:
private String getHtmlBegin() { return "<!DOCTYPE html>\n" + "<html lang=\"en\">\n" + "<head>\n" + "<meta charset=\"UTF-8\">\n" + "<title>sampleFile - OpenGrok cross reference" + " for /sampleFile</title></head><body>\n"; }
Source:
public SpecialPathInfo getSpecialPathInfo( Transfer transfer, String pkgType ) { if ( transfer != null ) { return getSpecialPathInfo( transfer.getLocation(), transfer.getStoragePath(), pkgType ); } return null; }

Target:
public SpecialPathInfo getSpecialPathInfo( Transfer transfer, String pkgType ) { if ( transfer != null ) { return getSpecialPathInfo( transfer.getLocation(), transfer.getPath(), pkgType ); } return null; }
Source:
public void passesValidationForNullPaymentOutcome() { CreateTelephonePaymentRequest telephonePaymentRequest = telephoneRequestBuilder .paymentOutcome(null) .build();; Set<ConstraintViolation<CreateTelephonePaymentRequest>> constraintViolations = validator.validate(telephonePaymentRequest); assertThat(constraintViolations.size(), is(1)); assertThat(constraintViolations.iterator().next().getMessage().equals("Field [payment_outcome] must include a valid status and error code"), is(false)); }

Target:
public void passesValidationForNullPaymentOutcome() { CreateTelephonePaymentRequest telephonePaymentRequest = telephoneRequestBuilder .withPaymentOutcome(null) .build();; Set<ConstraintViolation<CreateTelephonePaymentRequest>> constraintViolations = validator.validate(telephonePaymentRequest); assertThat(constraintViolations.size(), is(1)); assertThat(constraintViolations.iterator().next().getMessage().equals("Field [payment_outcome] must include a valid status and error code"), is(false)); }
Source:
public AttributeDefinition getAttributeDefinition() { AttributeDefinition attr = new AttributeDefinition(); attr.setNamespace(AttributesManager.NS_MEMBER_ATTR_DEF); attr.setFriendlyName("mail"); attr.setDisplayName("Mails"); attr.setType(String.class.getName()); attr.setDescription("Member's trusted mail."); return attr; }

Target:
public AttributeDefinition getAttributeDefinition() { AttributeDefinition attr = new AttributeDefinition(); attr.setNamespace(AttributesManager.NS_MEMBER_ATTR_DEF); attr.setFriendlyName("mail"); attr.setDisplayName("Mail"); attr.setType(String.class.getName()); attr.setDescription("Member's trusted mail."); return attr; }
Source:
public void givenASinglePostRequestWhenResponseThenLog() throws InterruptedException { AtomicInteger completedReqs = new AtomicInteger(0); WSClient ws = play.test.WSTestClient.newClient(port); ws.url(url) .setContentType("application/x-www-form-urlencoded") .post("key1=value1&key2=value2") .thenAccept(r -> { log.debug("Thread#" + Thread.currentThread() .getId() + " Request complete: Response code = " + r.getStatus() + " | Response: " + r.getBody() + " | Current Time:" + System.currentTimeMillis()); completedReqs.incrementAndGet(); }); log.debug( "Waiting for requests to be completed. Current Time: " + System.currentTimeMillis()); while (completedReqs.get() != 1) { Thread.sleep(100); } log.debug("All requests have been completed. Exiting test."); }

Target:
public void givenASinglePostRequestWhenResponseThenLog() throws Exception { CountDownLatch latch = new CountDownLatch(1); WSClient ws = play.test.WSTestClient.newClient(port); ws.url(url) .setContentType("application/x-www-form-urlencoded") .post("key1=value1&key2=value2") .thenAccept(r -> { log.debug("Thread#" + Thread.currentThread() .getId() + " Request complete: Response code = " + r.getStatus() + " | Response: " + r.getBody() + " | Current Time:" + System.currentTimeMillis()); latch.countDown(); }); log.debug( "Waiting for requests to be completed. Current Time: " + System.currentTimeMillis()); latch.await(5, TimeUnit.SECONDS ); assertEquals(0, latch.getCount()); log.debug("All requests have been completed. Exiting test."); }
Source:
private boolean isInDayset(String daysetName, ZonedDateTime date) { if (daysets.containsKey(daysetName)) { DayOfWeek dow = date.getDayOfWeek(); return daysets.get(daysetName).contains(dow); } else { logger.warn("This dayset does is not configured : {}", daysetName); return false; } }

Target:
private boolean isInDayset(String daysetName, ZonedDateTime date) { if (daysets.containsKey(daysetName)) { DayOfWeek dow = date.getDayOfWeek(); return daysets.get(daysetName).contains(dow); } else { logger.warn("This dayset is not configured : {}", daysetName); return false; } }
Source:
public static void main(String[] args) throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSet<String> text = getTextDataSet(env); DataSet<Tuple2<String, Integer>> counts = text.flatMap(new LineSplitter()) .groupBy(0) .aggregate(Aggregations.SUM, 1); counts.print(); env.execute("WordCount Example"); }

Target:
public static void main(String[] args) throws Exception { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSet<String> text = env.fromElements( "To be, or not to be,--that is the question:--", "Whether 'tis nobler in the mind to suffer", "The slings and arrows of outrageous fortune", "Or to take arms against a sea of troubles," ); DataSet<Tuple2<String, Integer>> counts = text.flatMap(new LineSplitter()) .groupBy(0) .aggregate(Aggregations.SUM, 1); counts.print(); env.execute("WordCount Example"); }
Source:
protected TestTransactionManager constructTestTransactionManager() { return new WrappingTestTransactionManagerImpl( metricsManager, keyValueService, timestampService, timestampService, lockClient, lockService, transactionService, conflictDetectionManager, sweepStrategyManager, sweepQueue, MoreExecutors.newDirectExecutorService(), transactionWrapper, keyValueServiceWrapper); }

Target:
protected TestTransactionManager constructTestTransactionManager() { return new TestTransactionManagerImpl( metricsManager, keyValueService, timestampService, timestampService, lockClient, lockService, transactionService, conflictDetectionManager, sweepStrategyManager, sweepQueue, MoreExecutors.newDirectExecutorService(), transactionWrapper, keyValueServiceWrapper); }
Source:
protected JoinAccumulator hashJoin(List<Tuple> tuples) { clearHashedInputs(); JoinAccumulator probe = new JoinAccumulator(); String firstStream = streamJoinOrder.get(0); for (Tuple t : tuples) { TupleImpl tuple = (TupleImpl) t; String streamId = getStreamSelector(tuple); if ( ! streamId.equals(firstStream) ) { Object key = getKeyField(streamId, tuple); ArrayList<TupleImpl> recs = hashedInputs.get(streamId).get(key); if(recs == null) { recs = new ArrayList<TupleImpl>(); hashedInputs.get(streamId).put(key, recs); } recs.add(tuple); } else { ResultRecord probeRecord = new ResultRecord(tuple, streamJoinOrder.size() == 1); probe.insert( probeRecord ); } } for (int i = 1; i < streamJoinOrder.size(); i++) { String streamName = streamJoinOrder.get(i) ; boolean finalJoin = (i==streamJoinOrder.size()-1); probe = doJoin(probe, hashedInputs.get(streamName), joinCriteria.get(streamName), finalJoin ); } return probe; }

Target:
protected JoinAccumulator hashJoin(List<Tuple> tuples) { clearHashedInputs(); JoinAccumulator probe = new JoinAccumulator(); String firstStream = joinCriteria.keySet().iterator().next(); for (Tuple tuple : tuples) { String streamId = getStreamSelector(tuple); if ( ! streamId.equals(firstStream) ) { Object key = getKeyField(streamId, tuple); ArrayList<Tuple> recs = hashedInputs.get(streamId).get(key); if(recs == null) { recs = new ArrayList<Tuple>(); hashedInputs.get(streamId).put(key, recs); } recs.add(tuple); } else { ResultRecord probeRecord = new ResultRecord(tuple, joinCriteria.size() == 1); probe.insert( probeRecord ); } } int i=0; for (String streamName : joinCriteria.keySet() ) { boolean finalJoin = (i==joinCriteria.size()-1); if(i>0) { probe = doJoin(probe, hashedInputs.get(streamName), joinCriteria.get(streamName), finalJoin); } ++i; } return probe; }
Source:
protected static ModelNode executeWhoAmI() throws IOException { ModelControllerClient client = ModelControllerClient.Factory .create(new ModelControllerClientConfiguration.Builder().setHostName(TestSuiteEnvironment.getServerAddress()) .setPort(PORT_NATIVE).setProtocol("remote").setConnectionTimeout(CONNECTION_TIMEOUT_IN_MS).build()); ModelNode operation = new ModelNode(); operation.get("operation").set("whoami"); operation.get("verbose").set("true"); return client.execute(operation); }

Target:
protected static ModelNode executeWhoAmI() throws IOException { try (ModelControllerClient client = ModelControllerClient.Factory .create(new ModelControllerClientConfiguration.Builder().setHostName(TestSuiteEnvironment.getServerAddress()) .setPort(PORT_NATIVE).setProtocol("remote").setConnectionTimeout(CONNECTION_TIMEOUT_IN_MS).build())) { ModelNode operation = new ModelNode(); operation.get("operation").set("whoami"); operation.get("verbose").set("true"); return client.execute(operation); } }
Source:
private Iterable<NameKey> scan() { if (matchPrefix != null) { return projectCache.byName(matchPrefix); } else if (type == FilterType.PARENT_CANDIDATES) { SortedSet<Project.NameKey> parents = new TreeSet<Project.NameKey>(); for (NameKey pName : projectCache.all()) { ProjectState e = projectCache.get(pName); if (e == null) { continue; } ProjectState parentState = e.getParentState(); if (parentState != null) { ProjectControl parentCtrl = parentState.controlFor(currentUser); if (parentCtrl.isVisible() || parentCtrl.isOwner()) { parents.add(parentState.getProject().getNameKey()); } } } return parents; } else { return projectCache.all(); } }

Target:
private Iterable<NameKey> scan() { if (matchPrefix != null) { return projectCache.byName(matchPrefix); } else if (type == FilterType.PARENT_CANDIDATES) { SortedSet<Project.NameKey> parents = new TreeSet<Project.NameKey>(); for (NameKey pName : projectCache.all()) { ProjectState e = projectCache.get(pName); if (e == null) { continue; } ProjectState parentState = e.getParentState(); if (parentState != null && !parents.contains(parentState.getProject().getNameKey())) { ProjectControl parentCtrl = parentState.controlFor(currentUser); if (parentCtrl.isVisible() || parentCtrl.isOwner()) { parents.add(parentState.getProject().getNameKey()); } } } return parents; } else { return projectCache.all(); } }
Source:
public void testCreateArtifactsEmpty() { DoorsTableRowCollector dtc = new DoorsTableRowCollector(extractor); RoughArtifact roughParent = new RoughArtifact(RoughArtifactKind.CONTAINER); RoughArtifactCollector collector = new RoughArtifactCollector(roughParent); dtc.createArtifacts(collector); Assert.fail(); }

Target:
public void testCreateArtifactsEmpty() { RoughArtifact roughParent = new RoughArtifact(RoughArtifactKind.CONTAINER); RoughArtifactCollector collector = new RoughArtifactCollector(roughParent); dtc.createArtifacts(collector); }
Source:
@Test public void throwingOnFailLogs() throws Exception { webServer.enqueue(new MockResponse().setResponseCode(200).setBody("Body")); final RuntimeException e = new RuntimeException(); clientListener.setNextEventDelegate(new WebSocketListener() { @Override public void onFailure(WebSocket webSocket, Throwable t, Response response) { throw e; } }); newWebSocket(); assertThat(testLogHandler.take()).isEqualTo(""); }

Target:
@Test public void throwingOnFailLogs() throws Exception { webServer.enqueue(new MockResponse().setResponseCode(200).setBody("Body")); final RuntimeException e = new RuntimeException("boom"); clientListener.setNextEventDelegate(new WebSocketListener() { @Override public void onFailure(WebSocket webSocket, Throwable t, Response response) { throw e; } }); newWebSocket(); assertThat(testLogHandler.take()).isEqualTo("INFO: [WS client] onFailure"); }
Source:
public void setEnabled (boolean enabled) { checkWidget(); long topHandle = topHandle (); if (this.enabled == enabled) return; this.enabled = enabled; if (!enabled && disabledImage != null) setImage (disabledImage); if (enabled && enabledImage != null) setImage (enabledImage); GTK.gtk_widget_set_sensitive (topHandle, enabled); }

Target:
public void setEnabled (boolean enabled) { checkWidget(); long topHandle = topHandle (); if (this.enabled == enabled) return; this.enabled = enabled; if (!enabled && disabledImage != null) _setImage (disabledImage); if (enabled && enabledImage != null) setImage (enabledImage); GTK.gtk_widget_set_sensitive (topHandle, enabled); }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; SamzaSqlRelMessage other = (SamzaSqlRelMessage) obj; if (key == null) { if (other.key != null) return false; } else if (!key.equals(other.key)) return false; if (samzaSqlRelRecord == null) { if (other.samzaSqlRelRecord != null) return false; } else if (!samzaSqlRelRecord.equals(other.samzaSqlRelRecord)) return false; return true; }

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; SamzaSqlRelMessage other = (SamzaSqlRelMessage) obj; return Objects.equals(key, other.key) && Objects.equals(samzaSqlRelRecord, other.samzaSqlRelRecord); }
Source:
public void testClassFileIsCompiled() throws Exception { JackBasedToolchain toolchain = AbstractTestTools.getCandidateToolchain(JackBasedToolchain.class, Collections.<Class<? extends IToolchain>>singletonList(JillBasedToolchain.class)); File[] defaultClasspath = toolchain.getDefaultBootClasspath(); File jackOut = AbstractTestTools.createTempFile("jackOut", toolchain.getLibraryExtension()); File classOut = AbstractTestTools.createTempDir(); File sourceDir = AbstractTestTools.getTestRootDir("com.android.jack.classfile.test001"); toolchain.addProperty(Options.EMIT_CLASS_FILES.getName(), "true"); toolchain.addProperty(Options.EMIT_CLASS_FILES_FOLDER.getName(), classOut.getPath()); toolchain.addToClasspath(defaultClasspath) .srcToLib(jackOut, true, sourceDir); Assert.assertTrue( new File(classOut, "com/android/jack/classfile/test001/jack/ClassTest.class").isFile()); }

Target:
public void testClassFileIsCompiled() throws Exception { List<Class<? extends IToolchain>> excludeList = Collections.<Class<? extends IToolchain>>singletonList(JillBasedToolchain.class); JackBasedToolchain toolchain = AbstractTestTools.getCandidateToolchain(JackBasedToolchain.class, excludeList); File[] defaultClasspath = toolchain.getDefaultBootClasspath(); File jackOut = AbstractTestTools.createTempFile("jackOut", toolchain.getLibraryExtension()); File classOut = AbstractTestTools.createTempDir(); File sourceDir = AbstractTestTools.getTestRootDir("com.android.jack.classfile.test001"); toolchain.addProperty(Options.EMIT_CLASS_FILES.getName(), "true"); toolchain.addProperty(Options.EMIT_CLASS_FILES_FOLDER.getName(), classOut.getPath()); toolchain.addToClasspath(defaultClasspath) .srcToLib(jackOut, true, sourceDir); Assert.assertTrue( new File(classOut, "com/android/jack/classfile/test001/jack/ClassTest.class").isFile()); }
Source:
public void beforeClass() { _bucketDataAccessor = new ZkBucketDataAccessor(ZK_ADDR); LIST_FIELD = new ArrayList<>(); LIST_FIELD.add("1"); LIST_FIELD.add("2"); MAP_FIELD = new HashMap<>(); MAP_FIELD.put("1", "2"); }

Target:
public void beforeClass() { _bucketDataAccessor = new ZkBucketDataAccessor(ZK_ADDR); }
Source:
public static String appendIfNotBlank(final String str, final String suffix) { return isBlank(str) ? EMPTY : str + defaultString(suffix); }

Target:
public static String appendIfNotBlank(final String str, final String suffix) { if (isEmpty(suffix) || isBlank(str)) { return str; } return str + suffix; }
Source:
private static ILaunchConfigurationWorkingCopy getWorkingCopy(ILaunchConfiguration configuration) throws CoreException { ILaunchConfigurationWorkingCopy wc = null; if (configuration.isWorkingCopy()) { wc = (ILaunchConfigurationWorkingCopy) configuration; } else { wc = configuration.getWorkingCopy(); } return wc; }

Target:
private static ILaunchConfigurationWorkingCopy getWorkingCopy(ILaunchConfiguration configuration) throws CoreException { if (configuration.isWorkingCopy()) { return (ILaunchConfigurationWorkingCopy) configuration; } return configuration.getWorkingCopy(); }
Source:
Ref doPeel(Ref leaf) throws MissingObjectException, IOException { try (RevWalk rw = new RevWalk(repository)) { RevObject obj = rw.parseAny(leaf.getObjectId()); if (obj instanceof RevTag) { return new ObjectIdRef.PeeledTag( leaf.getStorage(), leaf.getName(), leaf.getObjectId(), rw.peel(obj).copy(), hasVersioning() ? leaf.getUpdateIndex() : Ref.UNDEFINED_UPDATE_INDEX); } else { return new ObjectIdRef.PeeledNonTag( leaf.getStorage(), leaf.getName(), leaf.getObjectId(), hasVersioning() ? leaf.getUpdateIndex() : Ref.UNDEFINED_UPDATE_INDEX); } } }

Target:
Ref doPeel(Ref leaf) throws MissingObjectException, IOException { try (RevWalk rw = new RevWalk(repository)) { RevObject obj = rw.parseAny(leaf.getObjectId()); if (obj instanceof RevTag) { return new ObjectIdRef.PeeledTag( leaf.getStorage(), leaf.getName(), leaf.getObjectId(), rw.peel(obj).copy(), hasVersioning() ? leaf.getUpdateIndex() : UNDEFINED_UPDATE_INDEX); } else { return new ObjectIdRef.PeeledNonTag( leaf.getStorage(), leaf.getName(), leaf.getObjectId(), hasVersioning() ? leaf.getUpdateIndex() : UNDEFINED_UPDATE_INDEX); } } }
Source:
public void updateRtt(long ssrc, long rtt) { receiveStats.setRtt(rtt); sendStats.setRtt(rtt); if (ssrc < 0) return; ReceiveTrackStatsImpl receiveStat = receiveSsrcStats.get(ssrc); if (receiveStat != null) receiveStat.setRtt(rtt); SendTrackStatsImpl sendStats = sendSsrcStats.get(ssrc); if (sendStats != null) sendStats.setRtt(rtt); }

Target:
public void updateRtt(long ssrc, long rtt) { receiveStats.setRtt(rtt); sendStats.setRtt(rtt); if (ssrc < 0) return; ReceiveTrackStatsImpl receiveSsrcStat = receiveSsrcStats.get(ssrc); if (receiveSsrcStat != null) receiveSsrcStat.setRtt(rtt); SendTrackStatsImpl sendSsrcStat = sendSsrcStats.get(ssrc); if (sendSsrcStat != null) sendSsrcStat.setRtt(rtt); }
Source:
private <T extends BaseConfigurationItem> T newInstance(Type type, String id) { try { RemoteDescriptor remoteDescriptor = (RemoteDescriptor) getDescriptor(type); T ci = remoteDescriptor.newInstance(id); for (PropertyDescriptor pd : remoteDescriptor.getPropertyDescriptors()) { if (pd.isAsContainment()) { String propertyName = pd.getName(); if (null == ci.getProperty(propertyName)) { switch (pd.getKind()) { case LIST_OF_CI: ci.setProperty(propertyName, newArrayList()); break; case SET_OF_CI: ci.setProperty(propertyName, newHashSet()); break; default: break; } } } } prefillPropertiesWithDefaultValues(ci, type); return ci; } catch (Throwable e) { String errorMsg = String.format("Unable to instantiate CI '%s' with id '%s'. %s", type, id, e.getMessage()); throw new RuntimeException(errorMsg, e); } }

Target:
private ConfigurationItem newInstance(Type type, String id) { try { RemoteDescriptor remoteDescriptor = (RemoteDescriptor) getDescriptor(type); BaseConfigurationItem ci; if (remoteDescriptor.isAssignableTo(typeForClass(EmbeddedDeployable.class))) { ci = new BaseEmbeddedDeployable(); } else if (remoteDescriptor.isAssignableTo(typeForClass(SourceArtifact.class))) { if (remoteDescriptor.isAssignableTo(typeForClass(FolderArtifact.class))) { ci = new BaseDeployableFolderArtifact(); } else { ci = new BaseDeployableFileArtifact(); } } else if (remoteDescriptor.isAssignableTo(typeForClass(Deployable.class))) { ci = new BaseDeployable(); } else { ci = new BaseConfigurationItem(); } ci.setId(id); ci.setType(type); for (PropertyDescriptor pd : remoteDescriptor.getPropertyDescriptors()) { if (pd.isAsContainment()) { String propertyName = pd.getName(); if (null == ci.getProperty(propertyName)) { switch (pd.getKind()) { case LIST_OF_CI: ci.setProperty(propertyName, newArrayList()); break; case SET_OF_CI: ci.setProperty(propertyName, newHashSet()); break; default: break; } } } } initSyntheticProperties(ci, type); return ci; } catch (Throwable e) { String errorMsg = String.format("Unable to instantiate CI '%s' with id '%s'. %s", type, id, e.getMessage()); throw new RuntimeException(errorMsg, e); } }
Source:
public void executeQueryCommand() { VDSGroup cluster = getVdsGroupDao().get(getParameters().getId()); getQueryReturnValue().setReturnValue(cluster.isGlusterCliBasedSchedulingOn()); }

Target:
public void executeQueryCommand() { VDSGroup cluster = clusterDao.get(getParameters().getId()); getQueryReturnValue().setReturnValue(cluster.isGlusterCliBasedSchedulingOn()); }
Source:
private Point getPreferredSize(SWTGridCell gridCell) { return gridCell.getPreferredSize() != null ? gridCell.getPreferredSize() : SWTGridCell.DEFAULT_PREFERRED_SIZE; }

Target:
private Point getPreferredSize(SWTGridCell gridCell) { return gridCell.getPreferredSize() != null ? gridCell.getPreferredSize() : DEFAULT_PREFERRED_SIZE; }