auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testPut() { ObjectMap<Object, Object> map = new ObjectMap<Object, Object>(); int max = 100; Object[] values = new Object[max]; for (int i = 0; i < max; i++) values[i] = new Long(System.currentTimeMillis()); for (int i = 0; i < values.length; i++) { Object key = new Integer(i); map.put(key, values[i]); assertTrue("2.0." + i, map.containsKey(key)); assertTrue("2.1." + i, map.containsValue(values[i])); assertEquals("2.2." + i, i + 1, map.size()); } assertEquals("3.0", max, map.size()); for (int i = 0; i < values.length; i++) { Object key = new Integer(i); assertTrue("3.1." + i, map.containsKey(key)); assertNotNull("3.2." + i, map.get(key)); } }

Target:
public void testPut() { ObjectMap<Integer, Object> map = new ObjectMap<Integer, Object>(); int max = 100; Object[] values = new Object[max]; for (int i = 0; i < max; i++) values[i] = new Long(System.currentTimeMillis()); for (int i = 0; i < values.length; i++) { Integer key = new Integer(i); map.put(key, values[i]); assertTrue("2.0." + i, map.containsKey(key)); assertTrue("2.1." + i, map.containsValue(values[i])); assertEquals("2.2." + i, i + 1, map.size()); } assertEquals("3.0", max, map.size()); for (int i = 0; i < values.length; i++) { Integer key = new Integer(i); assertTrue("3.1." + i, map.containsKey(key)); assertNotNull("3.2." + i, map.get(key)); } }
Source:
static ClientServerCompatibility areClientAndServerCompatible(int serverVersion, int clientMajorVersion, int clientMinorVersion) { ClientServerCompatibility compatibility = new ClientServerCompatibility(); if (VersionUtil.encodeMinPatchVersion(clientMajorVersion, clientMinorVersion) > serverVersion) { compatibility.setErrorCode(SQLExceptionCode.OUTDATED_JARS.getErrorCode()); return compatibility; } else if (VersionUtil.encodeMaxMinorVersion(clientMajorVersion) < serverVersion) { compatibility.setErrorCode(SQLExceptionCode.INCOMPATIBLE_CLIENT_SERVER_JAR.getErrorCode()); return compatibility; } compatibility.setCompatible(true); return compatibility; }

Target:
static ClientServerCompatibility areClientAndServerCompatible(int serverVersion, int clientMajorVersion, int clientMinorVersion) { ClientServerCompatibility compatibility = new ClientServerCompatibility(); if (VersionUtil.encodeMinPatchVersion(clientMajorVersion, clientMinorVersion) > serverVersion) { compatibility.setErrorCode(SQLExceptionCode.OUTDATED_JARS.getErrorCode()); compatibility.setCompatible(false); return compatibility; } else if (VersionUtil.encodeMaxMinorVersion(clientMajorVersion) < serverVersion) { compatibility.setErrorCode(SQLExceptionCode.INCOMPATIBLE_CLIENT_SERVER_JAR.getErrorCode()); compatibility.setCompatible(false); return compatibility; } compatibility.setCompatible(true); return compatibility; }
Source:
public CommentListingController(RedditURLParser.RedditURL url, final Context context) { if(url.pathType() == RedditURLParser.POST_COMMENT_LISTING_URL) { if(url.asPostCommentListURL().order == null) { url = url.asPostCommentListURL().order(defaultOrder(context)); } } else if(url.pathType() == RedditURLParser.USER_COMMENT_LISTING_URL) { if(url.asUserCommentListURL().order == null) { url = url.asUserCommentListURL().order(UserCommentListingURL.Sort.TOP); } } if(!(url instanceof CommentListingURL)) { throw new RuntimeException("Not comment listing URL"); } this.mUrl = (CommentListingURL)url; }

Target:
public CommentListingController(RedditURLParser.RedditURL url, final Context context) { if(url.pathType() == RedditURLParser.POST_COMMENT_LISTING_URL) { if(url.asPostCommentListURL().order == null) { url = url.asPostCommentListURL().order(defaultOrder(context)); } } else if(url.pathType() == RedditURLParser.USER_COMMENT_LISTING_URL) { if(url.asUserCommentListURL().order == null) { url = url.asUserCommentListURL().order(UserCommentListingURL.Sort.NEW); } } if(!(url instanceof CommentListingURL)) { throw new RuntimeException("Not comment listing URL"); } this.mUrl = (CommentListingURL)url; }
Source:
public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } CompositeValue that = (CompositeValue) o; assert components.length == that.components.length; for (int i = 0; i < components.length; ++i) { if (!Comparables.equal(components[i], that.components[i])) { return false; } } return true; }

Target:
public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } CompositeValue that = (CompositeValue) o; return Arrays.equals(components, that.components); }
Source:
public Builder dependency(String attribute, String dependsOn) { if (dependencies == null && dependsOn != null) { dependencies = new HashMap<>(); } if (dependencies != null) { dependencies.put(attribute, dependsOn); } return this; }

Target:
public Builder dependency(String attribute, String dependsOn) { if (dependencies == null && dependsOn != null) { dependencies = new DirectedAcyclicGraph<>(String.class); } if (dependencies != null) { dependencies.addVertex(attribute); dependencies.addVertex(dependsOn); dependencies.addEdge(dependsOn, attribute); } return this; }
Source:
public static String credentialReferencePartAsStringIfDefined(ModelNode credentialReferenceValue, String name) throws OperationFailedException { assert !credentialReferenceValue.isDefined() : credentialReferenceValue; ModelNode result = credentialReferenceValue.get(name); if (result.isDefined()) { return result.asString(); } return null; }

Target:
public static String credentialReferencePartAsStringIfDefined(ModelNode credentialReferenceValue, String name) throws OperationFailedException { assert credentialReferenceValue.isDefined() : credentialReferenceValue; ModelNode result = credentialReferenceValue.get(name); if (result.isDefined()) { return result.asString(); } return null; }
Source:
protected void walkProjection() { projection = new BasicDBObject(); boolean projectionOnFulltextScore = false; for (Operand op : selectClause.getSelectList().values()) { if (!(op instanceof Reference)) { throw new QueryParseException("Projection not supported: " + op); } FieldInfo fieldInfo = walkReference((Reference) op); if (!NXQL.ECM_UUID.equals(fieldInfo.prop) && !fieldInfo.prop.equals(fieldInfo.projectionField) && !fieldInfo.prop.contains("/")) { propertyKeys.put(fieldInfo.projectionField, fieldInfo.prop); } projection.put(fieldInfo.projectionField, ONE); if (fieldInfo.hasWildcard) { projectionHasWildcard = true; } if (fieldInfo.projectionField.equals(KEY_FULLTEXT_SCORE)) { projectionOnFulltextScore = true; } } if (projectionOnFulltextScore || sortOnFulltextScore) { if (!hasFulltext) { throw new QueryParseException(NXQL.ECM_FULLTEXT_SCORE + " cannot be used without " + NXQL.ECM_FULLTEXT); } projection.put(KEY_FULLTEXT_SCORE, new BasicDBObject(MONGODB_META, MONGODB_TEXT_SCORE)); } }

Target:
protected void walkProjection() { projection = new BasicDBObject(); boolean projectionOnFulltextScore = false; for (Operand op : selectClause.getSelectList().values()) { if (!(op instanceof Reference)) { throw new QueryParseException("Projection not supported: " + op); } FieldInfo fieldInfo = walkReference((Reference) op); String propertyField = fieldInfo.prop; if (!propertyField.equals(NXQL.ECM_UUID) && !propertyField.equals(fieldInfo.projectionField) && !propertyField.contains("/")) { propertyKeys.put(fieldInfo.projectionField, propertyField); } projection.put(fieldInfo.projectionField, ONE); if (fieldInfo.hasWildcard) { projectionHasWildcard = true; } if (fieldInfo.projectionField.equals(KEY_FULLTEXT_SCORE)) { projectionOnFulltextScore = true; } } if (projectionOnFulltextScore || sortOnFulltextScore) { if (!hasFulltext) { throw new QueryParseException(NXQL.ECM_FULLTEXT_SCORE + " cannot be used without " + NXQL.ECM_FULLTEXT); } projection.put(KEY_FULLTEXT_SCORE, new BasicDBObject(MONGODB_META, MONGODB_TEXT_SCORE)); } }
Source:
public String getNodesStats() { try { Response response = lowLevelClient.performRequest("GET", "/" + "_nodes/stats"); return EntityUtils.toString(response.getEntity()); } catch (IOException e) { throw new NuxeoException(e); } }

Target:
public String getNodesStats() { try { Response response = lowLevelClient.performRequest("GET", "/_nodes/stats"); return EntityUtils.toString(response.getEntity()); } catch (IOException e) { throw new NuxeoException(e); } }
Source:
public static BiConsumer createSetterFunction(Method setterMethod, Class<?> propertyType, MethodHandles.Lookup lookup) { final PropertySetterFactory propertySetterFactory; if (Object.class.isAssignableFrom(propertyType)) { propertySetterFactory = new ObjectPropertySetterFactory(setterMethod, propertyType, lookup); } else if (propertyType.equals(Boolean.TYPE)) { propertySetterFactory = new BooleanPropertySetterFactory(setterMethod, propertyType, lookup); } else if (propertyType.equals(Integer.TYPE)) { propertySetterFactory = new IntPropertySetterFactory(setterMethod, propertyType, lookup); } else if (propertyType.equals(Long.TYPE)) { propertySetterFactory = new LongPropertySetterFactory(setterMethod, propertyType, lookup); } else if (propertyType.equals(Float.TYPE)) { propertySetterFactory = new FloatPropertySetterFactory(setterMethod, propertyType, lookup); } else if (propertyType.equals(Double.TYPE)) { propertySetterFactory = new DoublePropertySetterFactory(setterMethod, propertyType, lookup); } else if (propertyType.equals(Character.TYPE)) { propertySetterFactory = new CharPropertySetterFactory(setterMethod, propertyType, lookup); } else if (propertyType.equals(Byte.TYPE)) { propertySetterFactory = new BytePropertySetterFactory(setterMethod, propertyType, lookup); } else if (propertyType.equals(Short.TYPE)) { propertySetterFactory = new ShortPropertySetterFactory(setterMethod, propertyType, lookup); } else { throw new IllegalArgumentException("Unsupported property type " + propertyType); } return propertySetterFactory.wrapSetterFunction(); }

Target:
public static BiConsumer createSetterFunction(Method setterMethod, Class<?> propertyType, MethodHandles.Lookup lookup) { final PropertySetterFactory propertySetterFactory; if (Object.class.isAssignableFrom(propertyType)) { propertySetterFactory = new ObjectPropertySetterFactory(setterMethod, propertyType, lookup); } else if (propertyType.equals(Boolean.TYPE)) { propertySetterFactory = new BooleanPropertySetterFactory(setterMethod, propertyType, lookup); } else if (propertyType.equals(Integer.TYPE)) { propertySetterFactory = new IntPropertySetterFactory(setterMethod, propertyType, lookup); } else if (propertyType.equals(Long.TYPE)) { propertySetterFactory = new LongPropertySetterFactory(setterMethod, propertyType, lookup); } else if (propertyType.equals(Float.TYPE)) { propertySetterFactory = new FloatPropertySetterFactory(setterMethod, propertyType, lookup); } else if (propertyType.equals(Double.TYPE)) { propertySetterFactory = new DoublePropertySetterFactory(setterMethod, propertyType, lookup); } else if (propertyType.equals(Character.TYPE)) { propertySetterFactory = new CharPropertySetterFactory(setterMethod, propertyType, lookup); } else if (propertyType.equals(Byte.TYPE)) { propertySetterFactory = new BytePropertySetterFactory(setterMethod, propertyType, lookup); } else if (propertyType.equals(Short.TYPE)) { propertySetterFactory = new ShortPropertySetterFactory(setterMethod, propertyType, lookup); } else { throw new IllegalArgumentException("Unsupported property type (" + propertyType + ")."); } return propertySetterFactory.wrapSetterFunction(); }
Source:
public List<OwDiscoveryItem> getAssociatedSensors(OwSensorType sensorType) { List<OwDiscoveryItem> returnList = new ArrayList<OwDiscoveryItem>(); for (OwDiscoveryItem owDiscoveryItem : associatedSensors) { if (sensorType == owDiscoveryItem.getSensorType()) { returnList.add(owDiscoveryItem); } } return returnList; }

Target:
public List<OwDiscoveryItem> getAssociatedSensors(OwSensorType sensorType) { List<OwDiscoveryItem> returnList = new ArrayList<>(); for (OwDiscoveryItem owDiscoveryItem : associatedSensors) { if (sensorType == owDiscoveryItem.getSensorType()) { returnList.add(owDiscoveryItem); } } return returnList; }
Source:
public void replaceBrick(GlusterBrickEntity oldBrick, GlusterBrickEntity newBrick) { getCallsHandler().executeModification("UpdateGlusterVolumeBrick", getCustomMapSqlParameterSource().addValue("id", oldBrick.getId()) .addValue("new_id", newBrick.getId()) .addValue("new_server_id", newBrick.getServerId()) .addValue("new_status", EnumUtils.nameOrNull(newBrick.getStatus()))); }

Target:
public void replaceBrick(GlusterBrickEntity oldBrick, GlusterBrickEntity newBrick) { getCallsHandler().executeModification("UpdateGlusterVolumeBrick", getCustomMapSqlParameterSource().addValue("id", oldBrick.getId()) .addValue("new_id", newBrick.getId()) .addValue("new_server_id", newBrick.getServerId()) .addValue("new_brick_dir", newBrick.getBrickDirectory()) .addValue("new_status", EnumUtils.nameOrNull(newBrick.getStatus()))); }
Source:
public void init(final ByteBuffer buf, final int position) { final int oldPosition = buf.position(); try { buf.position(position); buf.put(emptySketch); } finally { buf.position(oldPosition); } final WritableMemory mem = getMemory(buf).writableRegion(position, size); putSketchIntoCache(buf, position, new HllSketch(lgK, tgtHllType, mem)); }

Target:
public void init(final ByteBuffer buf, final int position) { final int oldPosition = buf.position(); try { buf.position(position); buf.put(emptySketch); } finally { buf.position(oldPosition); } final WritableMemory mem = getMemory(buf).writableRegion(position, size); putSketchIntoCache(buf, position, HllSketch.writableWrap(mem)); }
Source:
protected void createFolder(String path) { try { Files.createDirectories(Paths.get(path)); } catch (IOException e) { s_logger.error(String.format("Unable to create directory %s for template %s: %s%n", path, getTemplate().getUrl(), e.toString())); throw new CloudRuntimeException(e); } }

Target:
protected void createFolder(String path) { try { Files.createDirectories(Paths.get(path)); } catch (IOException e) { s_logger.error(String.format("Unable to create directory %s for template %s: %s%n", path, getTemplate().getUrl(), e.toString()), e); throw new CloudRuntimeException(e); } }
Source:
public static Set<String> getPreviousTypeParamNames(List<TypeParameter> typeParams, ASTNode missingNode) { Set<String> previousNames= new HashSet<>(); for (int i = 0; i < typeParams.size(); i++) { TypeParameter curr= typeParams.get(i); if (curr == missingNode) { return previousNames; } previousNames.add('<' + curr.getName().getIdentifier() + '>'); } return previousNames; }

Target:
public static Set<String> getPreviousTypeParamNames(List<TypeParameter> typeParams, ASTNode missingNode) { Set<String> previousNames= new HashSet<>(); for (TypeParameter curr : typeParams) { if (curr == missingNode) { return previousNames; } previousNames.add('<' + curr.getName().getIdentifier() + '>'); } return previousNames; }
Source:
protected ChronicleLogAppender(Codec<M> codec, File basePath, ChronicleRetentionDuration retention) { if (!exists(basePath)) { throw new IllegalArgumentException("Cannot open Chronicle Queues, invalid path: " + basePath); } if (log.isDebugEnabled()) { log.debug("Opening: " + toString()); } Objects.requireNonNull(codec); this.codec = codec; this.basePath = basePath; this.name = basePath.getName(); Path metadataPath = getMetadataPath(); Properties metadata; if (metadataPath.toFile().exists()) { metadata = readMetadata(getMetadataPath()); } else { metadata = guessMetadata(retention); } ChronicleRetentionDuration storedRetention = new ChronicleRetentionDuration( metadata.getProperty(RETENTION_KEY)); if (retention.disable()) { this.retention = ChronicleRetentionDuration.disableOf(storedRetention); } else if (retention.getRollCycle() != storedRetention.getRollCycle()) { throw new IllegalArgumentException(String.format("Cannot open Log %s: expecting retention: %s got: %s", name, storedRetention, retention)); } else { this.retention = retention; } this.nbPartitions = Integer.parseInt(metadata.getProperty(PARTITIONS_KEY)); this.blockSize = Integer.parseInt(metadata.getProperty(BLOCK_SIZE_KEY)); this.partitions = new ArrayList<>(nbPartitions); initPartitions(false); }

Target:
protected ChronicleLogAppender(Codec<M> codec, File basePath, ChronicleRetentionDuration retention) { if (!exists(basePath)) { throw new IllegalArgumentException("Cannot open Chronicle Queues, invalid path: " + basePath); } if (log.isDebugEnabled()) { log.debug("Opening: " + toString()); } Objects.requireNonNull(codec); this.codec = codec; this.basePath = basePath; this.name = basePath.getName(); Path metadataPath = getMetadataPath(); Properties metadata; if (metadataPath.toFile().exists()) { metadata = readMetadata(getMetadataPath()); } else { metadata = guessMetadata(retention); } ChronicleRetentionDuration storedRetention = new ChronicleRetentionDuration( metadata.getProperty(RETENTION_KEY)); if (retention.disable()) { this.retention = ChronicleRetentionDuration.disableOf(storedRetention); } else if (retention.getRollCycle() == storedRetention.getRollCycle()) { this.retention = retention; } else { throw new IllegalArgumentException(String.format("Cannot open Log %s: expecting retention: %s got: %s", name, storedRetention, retention)); } this.nbPartitions = Integer.parseInt(metadata.getProperty(PARTITIONS_KEY)); this.blockSize = Integer.parseInt(metadata.getProperty(BLOCK_SIZE_KEY)); this.partitions = new ArrayList<>(nbPartitions); initPartitions(false); }
Source:
public void ValidationStereotypesListClass1Test() { EList<Stereotype> appliedStereotypes = class1.getAppliedStereotypes(); List<Stereotype> expectedStereotypes = new ArrayList<Stereotype>(); expectedStereotypes.add(stereotype1); expectedStereotypes.add(stereotype2); assertEquals(appliedStereotypes, expectedStereotypes); }

Target:
public void ValidationStereotypesListClass1Test() { EList<Stereotype> appliedStereotypes = class1.getAppliedStereotypes(); List<Stereotype> expectedStereotypes = new ArrayList<Stereotype>(); expectedStereotypes.add(stereotype1); expectedStereotypes.add(stereotype2); assertEquals("The stereotypes applied on the class must be the same as the expected stereotypes.", appliedStereotypes, expectedStereotypes); }
Source:
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { try { Command command = (Command) msg; logger.info("Executing Redis command: {}", command); executeCommand(ctx, command); } catch (Exception e) { logger.error(e); e.printStackTrace(); throw e; } }

Target:
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { Command command = (Command) msg; try { logger.info("Executing Redis command: {}", command); executeCommand(ctx, command); } catch (Exception e) { logger.error( "Execution of Redis command " + command + " failed", e); throw e; } }
Source:
private List<VariableSymbol> getBooleanParametersAsSymbol(List<VariableTree> parameters) { List<VariableSymbol> booleanParameters = Lists.newLinkedList(); for (VariableTree variableTree : parameters) { if (isBooleanVariable(variableTree)) { booleanParameters.add(((VariableTreeImpl) variableTree).getSymbol()); } } return booleanParameters; }

Target:
private List<VariableSymbol> getBooleanParametersAsSymbol(List<VariableTree> parameters) { List<VariableSymbol> booleanParameters = Lists.newLinkedList(); for (VariableTree variableTree : parameters) { VariableSymbol variableSymbol = ((VariableTreeImpl) variableTree).getSymbol(); if (isBooleanVariable(variableSymbol)) { booleanParameters.add(variableSymbol); } } return booleanParameters; }
Source:
private void checkVmLeaseStorageDomain() { StorageDomain leaseStorageDomain = storageDomainDao.getForStoragePool(getVm().getLeaseStorageDomainId(), getVm().getStoragePoolId()); StorageDomainValidator storageDomainValidator = new StorageDomainValidator(leaseStorageDomain); ValidationResult validationResult = storageDomainValidator.isDomainExistAndActive(); if (!validate(validationResult)) { log.warn("The VM lease storage domain (${LeaseStorageDomainName}) status is not active, " + "VM '{}' will fail to run in case the storage domain isn't reachable", leaseStorageDomain.getName(), getVm().getName()); } }

Target:
protected void checkVmLeaseStorageDomain() { StorageDomain leaseStorageDomain = storageDomainDao.getForStoragePool(getVm().getLeaseStorageDomainId(), getVm().getStoragePoolId()); StorageDomainValidator storageDomainValidator = new StorageDomainValidator(leaseStorageDomain); ValidationResult validationResult = storageDomainValidator.isDomainExistAndActive(); if (!validate(validationResult)) { log.warn("The VM lease storage domain (${LeaseStorageDomainName}) status is not active, " + "VM '{}' will fail to run in case the storage domain isn't reachable", leaseStorageDomain.getName(), getVm().getName()); } }
Source:
private void addCompoundUninstallTaskFor(Feature feature, TaskList tasks) { tasks.add( Operation.UNINSTALL, feature.getId(), HashMap<String, Set<Feature>>::new, (features, r) -> uninstallFeatures(r, features), (id, features) -> features .computeIfAbsent(FeaturesService.ROOT_REGION, r -> new HashSet<>()) .add(feature)); }

Target:
private void addCompoundUninstallTaskFor(Feature feature, TaskList tasks) { tasks .addIfAbsent( Operation.UNINSTALL, HashMap<String, Set<Feature>>::new, (features, r) -> uninstallFeatures(r, features)) .add( feature.getId(), features -> features .computeIfAbsent(FeaturesService.ROOT_REGION, r -> new HashSet<>()) .add(feature)); }
Source:
public void setAction(Action newAction) { if (!Action.COMMENT.equals(action) && Action.COMMENT.equals(newAction)) { if (comment == null) comment = "# " + action.token + " " + ((commit == null) ? "null" : commit.toString()) + " " + ((shortMessage == null) ? "null" : shortMessage); } else if (Action.COMMENT.equals(action) && !Action.COMMENT.equals(newAction)) { if (commit == null) throw new JGitInternalException(MessageFormat.format( JGitText.get().cannotChangeActionOnComment, action, newAction)); } this.action = newAction; }

Target:
public void setAction(Action newAction) { if (!Action.COMMENT.equals(action) && Action.COMMENT.equals(newAction)) { if (comment == null) comment = "# " + action.token + " " + ((commit == null) ? "null" : commit.name()) + " " + ((shortMessage == null) ? "null" : shortMessage); } else if (Action.COMMENT.equals(action) && !Action.COMMENT.equals(newAction)) { if (commit == null) throw new JGitInternalException(MessageFormat.format( JGitText.get().cannotChangeActionOnComment, action, newAction)); } this.action = newAction; }
Source:
public File toFile() throws IOException { File file = File.createTempFile(getName().split("\\.")[0], "." + getName().split("\\.")[1]); file.setLastModified(getLastModified().getTime()); BufferedWriter writer = new BufferedWriter(new FileWriter(file)); writer.write(new String(getContent(), "UTF-8")); writer.close(); return file; }

Target:
public File toFile() throws IOException { String[] nameParts = getName().split("\\."); File file = File.createTempFile(nameParts[0], "." + nameParts[1]); file.setLastModified(getLastModified().getTime()); FileOutputStream fos = new FileOutputStream(file); fos.write(getContent()); fos.close(); return file; }
Source:
private static DecimalFormat getCryptoFormat() { DecimalFormat cryptoFormat = new DecimalFormat(); cryptoFormat.setDecimalFormatSymbols(CUSTOM_SYMBOLS); cryptoFormat.setMaximumFractionDigits(4); cryptoFormat.setGroupingUsed(false); cryptoFormat.setRoundingMode(RoundingMode.UNNECESSARY); return cryptoFormat; }

Target:
private static DecimalFormat getCryptoFormat() { DecimalFormat cryptoFormat = new DecimalFormat(); cryptoFormat.setDecimalFormatSymbols(CUSTOM_SYMBOLS); cryptoFormat.setMaximumFractionDigits(4); cryptoFormat.setGroupingUsed(false); cryptoFormat.setRoundingMode(RoundingMode.DOWN); return cryptoFormat; }
Source:
public AnalysisJobBuilder removeSourceColumn(MetaModelInputColumn inputColumn) { boolean removed = _sourceColumns.remove(inputColumn); if (removed) { List<SourceColumnChangeListener> listeners = new ArrayList<>(_sourceColumnListeners); for (SourceColumnChangeListener listener : listeners) { listener.onRemove(inputColumn); } } return this; }

Target:
public AnalysisJobBuilder removeSourceColumn(MetaModelInputColumn inputColumn) { final boolean removed = _sourceColumns.remove(inputColumn); if (removed) { final List<SourceColumnChangeListener> listeners = new ArrayList<>(_sourceColumnListeners); for (SourceColumnChangeListener listener : listeners) { listener.onRemove(inputColumn); } } return this; }
Source:
private static Concept buildAllergen(AllergyIntolerance allergyIntolerance) { if (allergyIntolerance.getCode() != null) { return FHIRUtils.getConceptByCodeableConcept(allergyIntolerance.getCode()); } return null; }

Target:
private static Concept buildAllergen(AllergyIntolerance allergyIntolerance) { return (allergyIntolerance.getCode() != null) ? FHIRUtils.getConceptByCodeableConcept(allergyIntolerance.getCode()) : null; }
Source:
private void releaseAfterCancel(HttpMethod method) { if (mayHaveBody(method) && this.state.compareAndSet(ReactorNettyResponseState.NOT_SUBSCRIBED, ReactorNettyResponseState.CANCELLED)) { if (logger.isDebugEnabled()) { logger.debug("Releasing body, not yet subscribed"); } this.bodyIntern() .doOnNext(byteBuf -> {}) .subscribe(byteBuf -> {}, ex -> {}); } }

Target:
private void releaseAfterCancel(HttpMethod method) { if (this.state.compareAndSet(ReactorNettyResponseState.NOT_SUBSCRIBED, ReactorNettyResponseState.CANCELLED)) { if (logger.isDebugEnabled()) { logger.debug("Releasing body, not yet subscribed"); } this.bodyIntern() .doOnNext(byteBuf -> {}) .subscribe(byteBuf -> {}, ex -> {}); } }
Source:
private boolean validate(String resource, String partition, String participant) { int usage = _capacityProvider.getParticipantUsage(participant) + (_pendingUsage .containsKey(participant) ? _pendingUsage.get(participant) : 0); return +_partitionWeightProvider.getPartitionWeight(resource, partition) + usage <= _capacityProvider.getParticipantCapacity(participant); }

Target:
private boolean validate(String resource, String partition, String participant) { int usage = _capacityProvider.getParticipantUsage(participant) + (_pendingUsage .containsKey(participant) ? _pendingUsage.get(participant) : 0); return _partitionWeightProvider.getPartitionWeight(resource, partition) + usage <= _capacityProvider.getParticipantCapacity(participant); }
Source:
public PhysicalOperation(OperatorFactory operatorFactory, Map<Symbol, Integer> layout, LocalExecutionPlanContext context, PipelineExecutionStrategy pipelineExecutionStrategy) { requireNonNull(operatorFactory, "operatorFactory is null"); requireNonNull(layout, "layout is null"); int channelCount = layout.values().stream().mapToInt(Integer::intValue).max().orElse(-1) + 1; checkArgument(layout.size() == channelCount, "invalid layout"); checkArgument(ImmutableSet.copyOf(layout.values()).containsAll(ContiguousSet.create(closedOpen(0, channelCount), integers())), "invalid layout"); Map<Integer, Symbol> channelLayout = ImmutableBiMap.copyOf(layout).inverse(); this.operatorFactories = ImmutableList.of(operatorFactory); this.layout = ImmutableMap.copyOf(layout); this.types = range(0, channelCount) .mapToObj(channelLayout::get) .map(context.getTypes()::get) .collect(toImmutableList()); verify(this.types.equals(operatorFactory.getTypes())); this.pipelineExecutionStrategy = pipelineExecutionStrategy; }

Target:
public PhysicalOperation(OperatorFactory operatorFactory, Map<Symbol, Integer> layout, LocalExecutionPlanContext context, PipelineExecutionStrategy pipelineExecutionStrategy) { this(operatorFactory, layout, context, Optional.empty(), pipelineExecutionStrategy); }
Source:
public boolean isValid() { long now = System.currentTimeMillis(); return expirationTimestamp == 0 || now <= expirationTimestamp && (!options.isKeepAliveTTLEnabled() || options.getKeepAliveTTL() * 1000 > now - initialTimestamp); }

Target:
public boolean isValid() { long now = System.currentTimeMillis(); return (expirationTimestamp == 0 || now <= expirationTimestamp) && (!options.isKeepAliveTTLEnabled() || options.getKeepAliveTTL() * 1000 > now - initialTimestamp); }
Source:
private Link createPaginationLink(String species, String assembly, int pageNumber, int pageSize, String linkName) { return new Link(linkTo(methodOn(ArchiveWSServerV2.class).getBrowsableStudies(species, assembly, pageNumber, pageSize)) .toUriComponentsBuilder() .toUriString(), linkName); }

Target:
private Link createPaginationLink(String species, String assembly, int pageNumber, int pageSize, String linkName) { return new Link(linkTo(methodOn(StudyWSServerV2.class).getBrowsableStudies(species, assembly, pageNumber, pageSize)) .toUriComponentsBuilder() .toUriString(), linkName); }
Source:
private boolean onTryGridConnect(EntityPlayer entityPlayer, ItemStack stack, ElectricalCableDescriptor cable, Direction side) { UUID uuid = entityPlayer.getPersistentID(); Pair<Coordinate, Direction> p = pending.get(uuid); GridElement other = null; if (p != null) { other = GridLink.getElementFromCoordinate(p.getLeft()); } if (!cable.equals(desc.cableDescriptor)) { Utils.addChatMessage(entityPlayer, "Wrong cable, you need " + desc.cableDescriptor.name); return true; } if (other == null || other == this) { Utils.addChatMessage(entityPlayer, "Setting starting point"); pending.put(uuid, Pair.of(this.coordinate(), side)); } else { final double distance = other.coordinate().trueDistanceTo(this.coordinate()); final int cableLength = (int) Math.ceil(distance); final int range = Math.min(connectRange, other.connectRange); if (stack.stackSize < distance) { Utils.addChatMessage(entityPlayer, "You need " + cableLength + " units of cable"); } else if (distance > range) { Utils.addChatMessage(entityPlayer, "Cannot connect, range " + Math.ceil(distance) + " and limit " + range + " blocks"); } else if (!this.canConnect(other)) { Utils.addChatMessage(entityPlayer, "Cannot connect these two objects"); } else if (!this.validLOS(other)) { Utils.addChatMessage(entityPlayer, "Cannot connect, no line of sight"); } else { if (GridLink.addLink(this, other, side, p.getRight(), cable, cableLength)) { Utils.addChatMessage(entityPlayer, "Added connection"); stack.splitStack(cableLength); } else { Utils.addChatMessage(entityPlayer, "Already connected"); } } pending.remove(uuid); } return true; }

Target:
private boolean onTryGridConnect(EntityPlayer entityPlayer, ItemStack stack, ElectricalCableDescriptor cable, Direction side) { UUID uuid = entityPlayer.getPersistentID(); Pair<Coordinate, Direction> p = pending.get(uuid); GridElement other = null; if (p != null) { other = GridLink.getElementFromCoordinate(p.getLeft()); } if (!cable.equals(desc.cableDescriptor)) { Utils.sendMessage(entityPlayer, "Wrong cable, you need " + desc.cableDescriptor.name); return true; } if (other == null || other == this) { Utils.sendMessage(entityPlayer, "Setting starting point"); pending.put(uuid, Pair.of(this.coordinate(), side)); } else { final double distance = other.coordinate().trueDistanceTo(this.coordinate()); final int cableLength = (int) Math.ceil(distance); final int range = Math.min(connectRange, other.connectRange); if (stack.getCount() < distance) { Utils.sendMessage(entityPlayer, "You need " + cableLength + " units of cable"); } else if (distance > range) { Utils.sendMessage(entityPlayer, "Cannot connect, range " + Math.ceil(distance) + " and limit " + range + " blocks"); } else if (!this.canConnect(other)) { Utils.sendMessage(entityPlayer, "Cannot connect these two objects"); } else if (!this.validLOS(other)) { Utils.sendMessage(entityPlayer, "Cannot connect, no line of sight"); } else { if (GridLink.addLink(this, other, side, p.getRight(), cable, cableLength)) { Utils.sendMessage(entityPlayer, "Added connection"); stack.splitStack(cableLength); } else { Utils.sendMessage(entityPlayer, "Already connected"); } } pending.remove(uuid); } return true; }
Source:
public DiskManager getDiskManager(PartitionId id) { return partitionToDiskManager.get(id); }

Target:
DiskManager getDiskManager(PartitionId id) { return partitionToDiskManager.get(id); }
Source:
public void start() { Preconditions.checkState(!started, "already started"); Preconditions.checkState(!exec.isShutdown(), "already stopped"); try { consumer = getKafkaConsumer(); exec.submit( new Runnable() { @Override public void run() { try { while (!Thread.currentThread().isInterrupted()) { final Notice notice = notices.take(); try { notice.handle(); } catch (Exception e) { log.makeAlert(e, "KafkaSupervisor[%s] failed to handle notice", dataSource) .addData("noticeClass", notice.getClass().getSimpleName()) .emit(); } } } catch (InterruptedException e) { log.info("KafkaSupervisor[%s] interrupted, exiting", dataSource); } } } ); } catch (Exception e) { log.makeAlert(e, "Exception starting KafkaSupervisor[%s]", dataSource) .emit(); throw Throwables.propagate(e); } firstRunTime = DateTime.now().plus(ioConfig.getStartDelay()); timer.scheduleAtFixedRate( buildRunTask(), firstRunTime.toDate(), Math.max(ioConfig.getPeriod().getMillis(), MAX_RUN_FREQUENCY_MILLIS) ); started = true; log.info("Started KafkaSupervisor[%s], first run in [%s]", dataSource, ioConfig.getStartDelay()); }

Target:
public void start() { Preconditions.checkState(!started, "already started"); Preconditions.checkState(!exec.isShutdown(), "already stopped"); try { consumer = getKafkaConsumer(); exec.submit( new Runnable() { @Override public void run() { try { while (!Thread.currentThread().isInterrupted()) { final Notice notice = notices.take(); try { notice.handle(); } catch (Exception e) { log.makeAlert(e, "KafkaSupervisor[%s] failed to handle notice", dataSource) .addData("noticeClass", notice.getClass().getSimpleName()) .emit(); } } } catch (InterruptedException e) { log.info("KafkaSupervisor[%s] interrupted, exiting", dataSource); } } } ); } catch (Exception e) { log.makeAlert(e, "Exception starting KafkaSupervisor[%s]", dataSource) .emit(); throw Throwables.propagate(e); } firstRunTime = DateTime.now().plus(ioConfig.getStartDelay()); scheduledExec.scheduleAtFixedRate( buildRunTask(), ioConfig.getStartDelay().getMillis(), Math.max(ioConfig.getPeriod().getMillis(), MAX_RUN_FREQUENCY_MILLIS), TimeUnit.MILLISECONDS ); started = true; log.info("Started KafkaSupervisor[%s], first run in [%s]", dataSource, ioConfig.getStartDelay()); }
Source:
public void initialize() throws HBaseIOException { try { if (rsGroupInfoManager == null) { List<RSGroupAdminEndpoint> cps = masterServices.getMasterCoprocessorHost().findCoprocessors(RSGroupAdminEndpoint.class); if (cps.size() != 1) { String msg = "Expected one implementation of GroupAdminEndpoint but found " + cps.size(); LOG.error(msg); throw new HBaseIOException(msg); } rsGroupInfoManager = cps.get(0).getGroupInfoManager(); if(rsGroupInfoManager == null){ String msg = "RSGroupInfoManager hasn't been initialized"; LOG.error(msg); throw new HBaseIOException(msg); } rsGroupInfoManager.start(); } } catch (IOException e) { throw new HBaseIOException("Failed to initialize GroupInfoManagerImpl", e); } Class<? extends LoadBalancer> balancerKlass = config.getClass(HBASE_RSGROUP_LOADBALANCER_CLASS, StochasticLoadBalancer.class, LoadBalancer.class); if (balancerKlass.equals(this.getClass())) { LOG.warn("The internal balancer of RSGroupBasedLoadBalancer cannot be itself, " + "falling back to the default LoadBalancer class"); balancerKlass = LoadBalancerFactory.getDefaultLoadBalancerClass(); } internalBalancer = ReflectionUtils.newInstance(balancerKlass, config); internalBalancer.setMasterServices(masterServices); if (clusterStatus != null) { internalBalancer.setClusterMetrics(clusterStatus); } internalBalancer.setConf(config); internalBalancer.initialize(); }

Target:
public void initialize() throws HBaseIOException { try { if (rsGroupInfoManager == null) { List<RSGroupAdminEndpoint> cps = masterServices.getMasterCoprocessorHost().findCoprocessors(RSGroupAdminEndpoint.class); if (cps.size() != 1) { String msg = "Expected one implementation of GroupAdminEndpoint but found " + cps.size(); LOG.error(msg); throw new HBaseIOException(msg); } rsGroupInfoManager = cps.get(0).getGroupInfoManager(); if(rsGroupInfoManager == null){ String msg = "RSGroupInfoManager hasn't been initialized"; LOG.error(msg); throw new HBaseIOException(msg); } rsGroupInfoManager.start(); } } catch (IOException e) { throw new HBaseIOException("Failed to initialize GroupInfoManagerImpl", e); } Class<? extends LoadBalancer> balancerClass = config.getClass(HBASE_RSGROUP_LOADBALANCER_CLASS, StochasticLoadBalancer.class, LoadBalancer.class); if (this.getClass().isAssignableFrom(balancerClass)) { LOG.warn("The internal balancer of RSGroupBasedLoadBalancer cannot be itself, " + "falling back to the default LoadBalancer class"); balancerClass = LoadBalancerFactory.getDefaultLoadBalancerClass(); } internalBalancer = ReflectionUtils.newInstance(balancerClass, config); internalBalancer.setMasterServices(masterServices); if (clusterStatus != null) { internalBalancer.setClusterMetrics(clusterStatus); } internalBalancer.setConf(config); internalBalancer.initialize(); }
Source:
private void cancelJob(GerritTriggeredEvent event) { if (!(job instanceof Queue.Task)) { logger.error("Error canceling job. The job is not of type Task."); } List<hudson.model.Queue.Item> itemsInQueue = Queue.getInstance().getItems((Queue.Task)job); for (hudson.model.Queue.Item item : itemsInQueue) { if (checkCausedByGerrit(event, item.getCauses())) { Queue.getInstance().cancel(item); } } String workaround = System.getProperty(JOB_ABORT); if ((workaround != null) && workaround.equals("false")) { return; } Jenkins jenkins = Jenkins.getInstance(); assert jenkins != null; for (Computer c : jenkins.getComputers()) { List<Executor> executors = new ArrayList<Executor>(); executors.addAll(c.getOneOffExecutors()); executors.addAll(c.getExecutors()); for (Executor e : executors) { Queue.Executable currentExecutable = e.getCurrentExecutable(); if (currentExecutable != null && currentExecutable instanceof Run<?, ?>) { Run<?, ?> run = (Run<?, ?>)currentExecutable; if (checkCausedByGerrit(event, run.getCauses())) { e.interrupt( Result.ABORTED, new NewPatchSetInterruption() ); } } } } }

Target:
private void cancelJob(GerritTriggeredEvent event) { if (!(job instanceof Queue.Task)) { logger.error("Error canceling job. The job is not of type Task. Job name: " + job.getName()); return; } List<hudson.model.Queue.Item> itemsInQueue = Queue.getInstance().getItems((Queue.Task)job); for (hudson.model.Queue.Item item : itemsInQueue) { if (checkCausedByGerrit(event, item.getCauses())) { Queue.getInstance().cancel(item); } } String workaround = System.getProperty(JOB_ABORT); if ((workaround != null) && workaround.equals("false")) { return; } Jenkins jenkins = Jenkins.getInstance(); assert jenkins != null; for (Computer c : jenkins.getComputers()) { List<Executor> executors = new ArrayList<Executor>(); executors.addAll(c.getOneOffExecutors()); executors.addAll(c.getExecutors()); for (Executor e : executors) { Queue.Executable currentExecutable = e.getCurrentExecutable(); if (currentExecutable != null && currentExecutable instanceof Run<?, ?>) { Run<?, ?> run = (Run<?, ?>)currentExecutable; if (checkCausedByGerrit(event, run.getCauses())) { e.interrupt( Result.ABORTED, new NewPatchSetInterruption() ); } } } } }
Source:
private void showContentView(@Content int content) { switch (content) { case FRAGMENT: findViewById(R.id.main_menu_buttons_container).setVisibility(View.VISIBLE); findViewById(R.id.runtime_permission_error_view).setVisibility(View.GONE); findViewById(R.id.progress_bar).setVisibility(View.GONE); break; case ERROR: findViewById(R.id.main_menu_buttons_container).setVisibility(View.GONE); findViewById(R.id.runtime_permission_error_view).setVisibility(View.VISIBLE); findViewById(R.id.progress_bar).setVisibility(View.GONE); break; case PROGRESS_BAR: findViewById(R.id.main_menu_buttons_container).setVisibility(View.GONE); findViewById(R.id.runtime_permission_error_view).setVisibility(View.GONE); findViewById(R.id.progress_bar).setVisibility(View.VISIBLE); break; } }

Target:
private void showContentView(@Content int content) { View fragment = findViewById(R.id.main_menu_buttons_container); View errorView = findViewById(R.id.runtime_permission_error_view); View progressBar = findViewById(R.id.progress_bar); switch (content) { case FRAGMENT: fragment.setVisibility(View.VISIBLE); errorView.setVisibility(View.GONE); progressBar.setVisibility(View.GONE); break; case ERROR: fragment.setVisibility(View.GONE); errorView.setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); break; case PROGRESS_BAR: fragment.setVisibility(View.GONE); errorView.setVisibility(View.GONE); progressBar.setVisibility(View.VISIBLE); break; } }
Source:
@Test public void stringArray() throws Exception { JavaFileObject source = JavaFileObjects.forSourceString("test.Test", Joiner.on('\n').join( "package test;", "import android.app.Activity;", "import butterknife.BindArray;", "public class Test extends Activity {", " @BindArray(1) String[] one;", "}" )); JavaFileObject expectedSource = JavaFileObjects.forSourceString("test/Test$$ViewBinder", "" + "package test;\n" + "import android.content.res.Resources;\n" + "import butterknife.ButterKnife;\n" + "import butterknife.Unbinder;\n" + "import butterknife.internal.Finder;\n" + "import butterknife.internal.ViewBinder;\n" + "import java.lang.Object;\n" + "import java.lang.Override;\n" + "import java.lang.SuppressWarnings;\n" + "public class Test$$ViewBinder<T extends Test> implements ViewBinder<T> {\n" + " @Override\n" + " @SuppressWarnings(\"ResourceType\")\n" + " public Unbinder bind(final Finder finder, final T target, Object source) {\n" + " Resources res = finder.getContext(source).getResources();\n" + " target.one = res.getStringArray(1);\n" + " return ButterKnife.NOP_UNBINDER;\n" + " }\n" + "}"); assertAbout(javaSource()).that(source) .processedWith(new ButterKnifeProcessor()) .compilesWithoutError() .and() .generatesSources(expectedSource); }

Target:
@Test public void stringArray() throws Exception { JavaFileObject source = JavaFileObjects.forSourceString("test.Test", Joiner.on('\n').join( "package test;", "import android.app.Activity;", "import butterknife.BindArray;", "public class Test extends Activity {", " @BindArray(1) String[] one;", "}" )); JavaFileObject expectedSource = JavaFileObjects.forSourceString("test/Test$$ViewBinder", "" + "package test;\n" + "import android.content.res.Resources;\n" + "import butterknife.Unbinder;\n" + "import butterknife.internal.Finder;\n" + "import butterknife.internal.ViewBinder;\n" + "import java.lang.Object;\n" + "import java.lang.Override;\n" + "import java.lang.SuppressWarnings;\n" + "public class Test$$ViewBinder<T extends Test> implements ViewBinder<T> {\n" + " @Override\n" + " @SuppressWarnings(\"ResourceType\")\n" + " public Unbinder bind(final Finder finder, final T target, Object source) {\n" + " Resources res = finder.getContext(source).getResources();\n" + " target.one = res.getStringArray(1);\n" + " return Unbinder.EMPTY;\n" + " }\n" + "}"); assertAbout(javaSource()).that(source) .processedWith(new ButterKnifeProcessor()) .compilesWithoutError() .and() .generatesSources(expectedSource); }
Source:
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) { Object credential = null; if (token instanceof SAMLAuthenticationToken) { try { samlAssertionValidator.validate((SAMLAuthenticationToken) token); credential = token.getCredentials(); } catch (AuthenticationFailureException e) { String msg = "Unable to validate request's authentication."; LOGGER.info(msg); throw new AuthenticationException(msg, e); } } if (credential == null) { String msg = "Unable to authenticate credential. A NULL credential was provided in the supplied authentication token. This may be due to an error with the SSO server that created the token."; LOGGER.info(msg); throw new AuthenticationException(msg); } else { LOGGER.debug("Received credentials."); } LOGGER.debug("Creating token authentication information with SAML."); SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo(); SecurityToken securityToken = checkForSecurityToken(credential); SimplePrincipalCollection principals = createPrincipalFromToken(securityToken); simpleAuthenticationInfo.setPrincipals(principals); simpleAuthenticationInfo.setCredentials(credential); return simpleAuthenticationInfo; }

Target:
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) { Object credential = null; if (token instanceof SAMLAuthenticationToken) { try { samlAssertionValidator.validate((SAMLAuthenticationToken) token); credential = token.getCredentials(); } catch (AuthenticationFailureException e) { String msg = "Unable to validate request's authentication."; LOGGER.info(msg); throw new AuthenticationException(msg, e); } } if (credential == null) { String msg = "Unable to authenticate credential. A NULL credential was provided in the supplied authentication token. This may be due to an error with the SSO server that created the token."; LOGGER.info(msg); throw new AuthenticationException(msg); } LOGGER.debug("Received credentials."); LOGGER.debug("Creating token authentication information with SAML."); SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo(); SecurityToken securityToken = checkForSecurityToken(credential); SimplePrincipalCollection principals = createPrincipalFromToken(securityToken); simpleAuthenticationInfo.setPrincipals(principals); simpleAuthenticationInfo.setCredentials(credential); return simpleAuthenticationInfo; }
Source:
private boolean updateDcConfiguration() { final String username = emailAddressTextField.getText(); final String password = new String(passwordTextField.getPassword()); try { RemoteServersUtils.checkServerWithCredentials(DATACLOUD_URL, username, password); } catch (Exception ex) { invalidCredentialsLabel.setForeground(new Color(170,10,10)); invalidCredentialsLabel.setText("Sign in to DataCloud failed: " + ex.getMessage()); logger.warn("Sign in to DataCloud failed for user '{}'", username, ex); return false; } invalidCredentialsLabel.setForeground(new Color(10,170,10)); invalidCredentialsLabel.setText("Sign in to DataCloud succeeded."); logger.debug("Sign in to DataCloud succeeded. User name: {}", username); final RemoteServerConfiguration remoteServerConfig = _configuration.getEnvironment().getRemoteServerConfiguration(); final RemoteServerData existingServerData = remoteServerConfig.getServerConfig(DATACLOUD_SERVER_NAME); if (existingServerData == null) { RemoteServersUtils.addRemoteServer(_configuration.getEnvironment(), DATACLOUD_SERVER_NAME, null, username, password); } else { RemoteServersUtils.updateRemoteServerCredentials(_configuration.getEnvironment(), DATACLOUD_SERVER_NAME, username, password); } return true; }

Target:
private boolean updateDcConfiguration() { final String username = emailAddressTextField.getText(); final String password = new String(passwordTextField.getPassword()); try { RemoteServersUtils.checkServerWithCredentials(DATACLOUD_URL, username, password); } catch (Exception ex) { invalidCredentialsLabel.setForeground(WidgetUtils.ADDITIONAL_COLOR_RED_BRIGHT); invalidCredentialsLabel.setText("Sign in to DataCloud failed: " + ex.getMessage()); logger.warn("Sign in to DataCloud failed for user '{}'", username, ex); return false; } invalidCredentialsLabel.setForeground(WidgetUtils.BG_COLOR_GREEN_MEDIUM); invalidCredentialsLabel.setText("Sign in to DataCloud succeeded."); logger.debug("Sign in to DataCloud succeeded. User name: {}", username); final RemoteServerConfiguration remoteServerConfig = _configuration.getEnvironment().getRemoteServerConfiguration(); final RemoteServerData existingServerData = remoteServerConfig.getServerConfig(DATACLOUD_SERVER_NAME); if (existingServerData == null) { RemoteServersUtils.addRemoteServer(_configuration.getEnvironment(), DATACLOUD_SERVER_NAME, null, username, password); } else { RemoteServersUtils.updateRemoteServerCredentials(_configuration.getEnvironment(), DATACLOUD_SERVER_NAME, username, password); } return true; }