auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Subscriber<T> createSubscriber(final SubscriberWhiteboxVerification.WhiteboxSubscriberProbe<T> probe) { final Processor<T, T> processor = createIdentityProcessor(processorBufferSize); processor.subscribe( new Subscriber<T>() { private final Promise<Subscription> subs = new Promise<Subscription>(env); @Override public void onSubscribe(final Subscription subscription) { if (env.debugEnabled()) env.debug(String.format("whiteboxSubscriber::onSubscribe(%s)", subscription)); if (subs.isCompleted()) subscription.cancel(); probe.registerOnSubscribe(new SubscriberWhiteboxVerification.SubscriberPuppet() { @Override public void triggerRequest(long elements) { subscription.request(elements); } @Override public void signalCancel() { subscription.cancel(); } }); } @Override public void onNext(T element) { if (env.debugEnabled()) env.debug(String.format("whiteboxSubscriber::onNext(%s)", element)); probe.registerOnNext(element); } @Override public void onComplete() { if (env.debugEnabled()) env.debug("whiteboxSubscriber::onComplete()"); probe.registerOnComplete(); } @Override public void onError(Throwable cause) { if (env.debugEnabled()) env.debug(String.format("whiteboxSubscriber::onError(%s)", cause)); probe.registerOnError(cause); } }); return processor; }

Target:
public Subscriber<T> createSubscriber(final SubscriberWhiteboxVerification.WhiteboxSubscriberProbe<T> probe) { final Processor<T, T> processor = createIdentityProcessor(processorBufferSize); processor.subscribe( new Subscriber<T>() { private final Promise<Subscription> subs = new Promise<Subscription>(env); @Override public void onSubscribe(final Subscription subscription) { if (env.debugEnabled()) { env.debug(String.format("whiteboxSubscriber::onSubscribe(%s)", subscription)); } if (subs.isCompleted()) subscription.cancel(); probe.registerOnSubscribe(new SubscriberWhiteboxVerification.SubscriberPuppet() { @Override public void triggerRequest(long elements) { subscription.request(elements); } @Override public void signalCancel() { subscription.cancel(); } }); } @Override public void onNext(T element) { if (env.debugEnabled()) { env.debug(String.format("whiteboxSubscriber::onNext(%s)", element)); } probe.registerOnNext(element); } @Override public void onComplete() { if (env.debugEnabled()) { env.debug("whiteboxSubscriber::onComplete()"); } probe.registerOnComplete(); } @Override public void onError(Throwable cause) { if (env.debugEnabled()) { env.debug(String.format("whiteboxSubscriber::onError(%s)", cause)); } probe.registerOnError(cause); } }); return processor; }
Source:
private GridClientAuthenticationRequest buildAuthRequest() { GridClientAuthenticationRequest req = new GridClientAuthenticationRequest(); long reqId = reqIdCntr.getAndIncrement(); req.requestId(reqId); req.clientId(clientId); req.credentials(credentials()); req.userAttributes(userAttrs); return req; }

Target:
private GridClientAuthenticationRequest buildAuthRequest() { GridClientAuthenticationRequest req = new GridClientAuthenticationRequest(); req.clientId(clientId); req.credentials(credentials()); req.userAttributes(userAttrs); return req; }
Source:
public void cloudRecoveryTestForLargeBlob() throws Exception { int userMetaDataSize = 100; byte[] userMetadata = new byte[userMetaDataSize]; TestUtils.RANDOM.nextBytes(userMetadata); Map<BlobId, Integer> blobIdToSizeMap = new HashMap<>(); int blobSize = FOUR_MB_SZ; for (BlobId blobId : blobIds) { byte[] data = new byte[blobSize]; BlobProperties blobProperties = new BlobProperties(blobSize, "serviceid1", null, null, false, Utils.Infinite_Time, accountId, containerId, false, null); TestUtils.RANDOM.nextBytes(data); blobIdToSizeMap.put(blobId, blobSize); PutMessageFormatInputStream putMessageFormatInputStream = new PutMessageFormatInputStream(blobId, null, blobProperties, ByteBuffer.wrap(userMetadata), new ByteBufferInputStream(ByteBuffer.wrap(data)), blobSize); long time = System.currentTimeMillis(); CloudBlobMetadata cloudBlobMetadata = new CloudBlobMetadata(blobId, time, Utils.Infinite_Time, putMessageFormatInputStream.getSize(), CloudBlobMetadata.EncryptionOrigin.NONE); latchBasedInMemoryCloudDestination.uploadBlob(blobId, putMessageFormatInputStream.getSize(), cloudBlobMetadata, putMessageFormatInputStream); } assertTrue("Did not recover all blobs in 2 minutes", latchBasedInMemoryCloudDestination.awaitDownload(2, TimeUnit.MINUTES)); Thread.sleep(10000); testGetOnRecoveryNode(blobIdToSizeMap); }

Target:
public void cloudRecoveryTestForLargeBlob() throws Exception { int userMetaDataSize = 100; byte[] userMetadata = new byte[userMetaDataSize]; TestUtils.RANDOM.nextBytes(userMetadata); Map<BlobId, Integer> blobIdToSizeMap = new HashMap<>(); int blobSize = FOUR_MB_SZ; for (BlobId blobId : blobIds) { byte[] data = new byte[blobSize]; BlobProperties blobProperties = new BlobProperties(blobSize, "serviceid1", null, null, false, Utils.Infinite_Time, accountId, containerId, false, null); TestUtils.RANDOM.nextBytes(data); blobIdToSizeMap.put(blobId, blobSize); PutMessageFormatInputStream putMessageFormatInputStream = new PutMessageFormatInputStream(blobId, null, blobProperties, ByteBuffer.wrap(userMetadata), new ByteBufferInputStream(ByteBuffer.wrap(data)), blobSize); long time = System.currentTimeMillis(); CloudBlobMetadata cloudBlobMetadata = new CloudBlobMetadata(blobId, time, Utils.Infinite_Time, putMessageFormatInputStream.getSize(), CloudBlobMetadata.EncryptionOrigin.NONE); latchBasedInMemoryCloudDestination.uploadBlob(blobId, putMessageFormatInputStream.getSize(), cloudBlobMetadata, putMessageFormatInputStream); } assertTrue("Did not recover all blobs in 1 minute", latchBasedInMemoryCloudDestination.awaitDownload(1, TimeUnit.MINUTES)); Thread.sleep(10000); testGetOnRecoveryNode(blobIdToSizeMap); }
Source:
public String getFunctionName() { return m_name.toUpperCase(); }

Target:
public String getFunctionName() { return m_name.toLowerCase(); }
Source:
public void operateOn(StructuredRecord record) { Object val = record.get(fieldName); if (val == null) { return; } double value = ((Number) val).doubleValue(); sum1 += value; sum2 += Math.pow(value, 2); stddev = Math.sqrt(count*sum2 - Math.pow(sum1, 2)); count++; }

Target:
public void operateOn(StructuredRecord record) { Object val = record.get(fieldName); if (val == null) { return; } double value = ((Number) val).doubleValue(); stats.push(value); }
Source:
abstract PdlBuilder newline() throws IOException; abstract PdlBuilder indent() throws IOException; abstract PdlBuilder increaseIndent(); abstract PdlBuilder decreaseIndent(); abstract boolean writeDoc(String doc) throws IOException; PdlBuilder writeProperties(List<String> prefix, Map<String, Object> properties) throws IOException { for (Map.Entry<String, Object> entry : properties.entrySet().stream() .sorted(Map.Entry.comparingByKey()) .collect(Collectors.toList())) { String key = entry.getKey(); Object value = entry.getValue(); ArrayList<String> pathParts = new ArrayList<>(prefix); pathParts.add(key); if (value instanceof DataMap) { DataMap dm = (DataMap) value; if (dm.size() == 1) { writeProperties(pathParts, dm); } else { writeProperty(pathParts, dm); } } else if (Boolean.TRUE.equals(value)) { indent().write("@").writePath(pathParts).newline(); } else { writeProperty(pathParts, value); } } return this; }

Target:
abstract PdlBuilder newline() throws IOException; abstract PdlBuilder indent() throws IOException; abstract PdlBuilder increaseIndent(); abstract PdlBuilder decreaseIndent(); abstract boolean writeDoc(String doc) throws IOException; PdlBuilder writeProperties(List<String> prefix, Map<String, Object> properties) throws IOException { List<Map.Entry<String, Object>> orderedProperties = properties.entrySet().stream() .sorted(Map.Entry.comparingByKey()) .collect(Collectors.toList()); for (Map.Entry<String, Object> entry : orderedProperties) { String key = entry.getKey(); Object value = entry.getValue(); ArrayList<String> pathParts = new ArrayList<>(prefix); pathParts.add(key); if (value instanceof DataMap) { DataMap dm = (DataMap) value; if (dm.size() == 1) { writeProperties(pathParts, dm); } else { writeProperty(pathParts, dm); } } else if (Boolean.TRUE.equals(value)) { indent().write("@").writePath(pathParts).newline(); } else { writeProperty(pathParts, value); } } return this; }
Source:
public void testExecute_notInRecycleBin_shouldPass() throws Exception { InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); String instructorId = instructor1OfCourse1.googleId; String courseId = instructor1OfCourse1.courseId; ______TS("Error case, delete a course not in Recycle Bin"); String[] submissionParams = new String[] { Const.ParamsNames.INSTRUCTOR_ID, instructorId, Const.ParamsNames.COURSE_ID, courseId, }; loginAsInstructor(instructorId); DeleteCourseAction action = getAction(submissionParams); action.checkSpecificAccessControl(); JsonResult result = getJsonResult(action); MessageOutput message = (MessageOutput) result.getOutput(); assertEquals(HttpStatus.SC_OK, result.getStatusCode()); assertEquals("The course " + courseId + " has been permanently deleted.", message.getMessage()); }

Target:
public void testExecute_notInRecycleBin_shouldPass() throws Exception { InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); String instructorId = instructor1OfCourse1.googleId; String courseId = instructor1OfCourse1.courseId; ______TS("delete a course not in Recycle Bin"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, courseId, }; CourseAttributes courseToBeDeleted = logic.getCourse(instructor1OfCourse1.courseId); assertNull(courseToBeDeleted.deletedAt); loginAsInstructor(instructorId); DeleteCourseAction deleteCourseAction = getAction(submissionParams); JsonResult result = getJsonResult(deleteCourseAction); MessageOutput messageOutput = (MessageOutput) result.getOutput(); assertEquals(HttpStatus.SC_OK, result.getStatusCode()); assertEquals("OK", messageOutput.getMessage()); assertNull(logic.getCourse(instructor1OfCourse1.courseId)); }
Source:
private boolean isTypeGuvnorEnum() { return conditionColumn != null && conditionColumn.getValueList() != null && conditionColumn.getValueList().split(",").length > 1; }

Target:
private boolean isTypeGuvnorEnum() { return conditionColumn != null && conditionColumn.getValueList() != null && !conditionColumn.getValueList().trim().isEmpty(); }
Source:
abstract void prepare() throws IOException; abstract boolean ready(); abstract long read() throws IOException; abstract boolean write() throws IOException; public abstract void close() throws IOException; String getConnectionId() { return connectionId; }

Target:
public abstract void prepare() throws IOException; public abstract boolean ready(); public abstract boolean read() throws IOException; public abstract boolean write() throws IOException; public boolean isReadComplete(){ if(networkReceive!= null){ return networkReceive.getReceivedBytes().isReadComplete(); } return false; }
Source:
public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException { String sql; sql = "SELECT NULL AS FUNCTION_CAT, n.nspname AS FUNCTION_SCHEM, p.proname AS FUNCTION_NAME, " + "d.description AS REMARKS, " + DatabaseMetaData.procedureReturnsResult + " AS FUNCTION_TYPE, " + " p.proname || '_' || p.oid AS SPECIFIC_NAME " + " FROM pg_catalog.pg_namespace n, pg_catalog.pg_proc p " + " LEFT JOIN pg_catalog.pg_description d ON (p.oid=d.objoid) " + " LEFT JOIN pg_catalog.pg_class c ON (d.classoid=c.oid AND c.relname='pg_proc') " + " LEFT JOIN pg_catalog.pg_namespace pn ON (c.relnamespace=pn.oid AND pn.nspname='pg_catalog') " + " WHERE p.pronamespace=n.oid "; if (schemaPattern != null && !schemaPattern.isEmpty()) { sql += " AND n.nspname LIKE " + escapeQuotes(schemaPattern); } if (functionNamePattern != null && !functionNamePattern.isEmpty()) { sql += " AND p.proname LIKE " + escapeQuotes(functionNamePattern); } sql += " ORDER BY FUNCTION_SCHEM, FUNCTION_NAME, p.oid::text "; return createMetaDataStatement().executeQuery(sql); }

Target:
public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException { boolean pgFuncResultExists = connection.haveMinimumServerVersion(ServerVersion.v8_4); String funcTypeSql = DatabaseMetaData.functionResultUnknown + " "; if (pgFuncResultExists) { funcTypeSql = " CASE " + " WHEN (format_type(p.prorettype, null) = 'unknown') THEN " + DatabaseMetaData.functionResultUnknown + " WHEN " + " (substring(pg_get_function_result(p.oid) from 0 for 6) = 'TABLE') OR " + " (substring(pg_get_function_result(p.oid) from 0 for 6) = 'SETOF') THEN " + DatabaseMetaData.functionReturnsTable + " ELSE " + DatabaseMetaData.functionNoTable + " END "; } String sql; sql = "SELECT current_database() AS FUNCTION_CAT, n.nspname AS FUNCTION_SCHEM, p.proname AS FUNCTION_NAME, " + " d.description AS REMARKS, " + funcTypeSql + " AS FUNCTION_TYPE, " + " p.proname || '_' || p.oid AS SPECIFIC_NAME " + "FROM pg_catalog.pg_proc p " + "INNER JOIN pg_catalog.pg_namespace n ON p.pronamespace=n.oid " + "LEFT JOIN pg_catalog.pg_description d ON p.oid=d.objoid " + "WHERE pg_function_is_visible(p.oid) "; if (schemaPattern != null && !schemaPattern.isEmpty()) { sql += " AND n.nspname LIKE " + escapeQuotes(schemaPattern); } if (functionNamePattern != null && !functionNamePattern.isEmpty()) { sql += " AND p.proname LIKE " + escapeQuotes(functionNamePattern); } sql += " ORDER BY FUNCTION_SCHEM, FUNCTION_NAME, p.oid::text "; return createMetaDataStatement().executeQuery(sql); }
Source:
private static boolean isArrayAggregateApplicable( GroupByQueryConfig config, GroupByQuery query, GroupByColumnSelectorPlus[] dims, StorageAdapter storageAdapter, ByteBuffer buffer ) { if (!config.isForceHashAggregation()) { final ColumnCapabilities columnCapabilities; final int cardinality; if (dims.length == 0) { columnCapabilities = null; cardinality = 1; } else if (dims.length == 1) { columnCapabilities = storageAdapter.getColumnCapabilities(dims[0].getName()); cardinality = storageAdapter.getDimensionCardinality(dims[0].getName()); } else { columnCapabilities = null; cardinality = -1; } if ((columnCapabilities == null || columnCapabilities.getType().equals(ValueType.STRING)) && cardinality > 0) { final AggregatorFactory[] aggregatorFactories = query .getAggregatorSpecs() .toArray(new AggregatorFactory[query.getAggregatorSpecs().size()]); final int requiredBufferCapacity = BufferArrayGrouper.requiredBufferCapacity( cardinality, aggregatorFactories ); if (requiredBufferCapacity <= buffer.capacity()) { return true; } } } return false; }

Target:
private static boolean isArrayAggregateApplicable( GroupByQueryConfig config, GroupByQuery query, GroupByColumnSelectorPlus[] dims, StorageAdapter storageAdapter, ByteBuffer buffer ) { if (config.isForceHashAggregation()) { return false; } final ColumnCapabilities columnCapabilities; final int cardinality; if (dims.length == 0) { columnCapabilities = null; cardinality = 1; } else if (dims.length == 1) { columnCapabilities = storageAdapter.getColumnCapabilities(dims[0].getName()); cardinality = storageAdapter.getDimensionCardinality(dims[0].getName()); } else { columnCapabilities = null; cardinality = -1; } if ((columnCapabilities == null || columnCapabilities.getType().equals(ValueType.STRING)) && cardinality > 0) { final AggregatorFactory[] aggregatorFactories = query .getAggregatorSpecs() .toArray(new AggregatorFactory[query.getAggregatorSpecs().size()]); final int requiredBufferCapacity = BufferArrayGrouper.requiredBufferCapacity( cardinality, aggregatorFactories ); if (requiredBufferCapacity <= buffer.capacity()) { return true; } } return false; }
Source:
public boolean bridge$affectsSpawning() { return this.affectsSpawning && !this.isSpectator() && !this.bridge$isVanished(); }

Target:
public boolean bridge$affectsSpawning() { return this.affectsSpawning && !this.isSpectator() && !this.bridge$isUntargetable(); }
Source:
private void onPhysicalRadioButtonChange(Object sender) { if (sender == getPhysicalNetworkDatacenterRB()) { getNeutronPhysicalNetwork().setIsChangeable(false); getDatacenterPhysicalNetwork().setIsChangeable(true); getPhysicalNetworkDatacenter().setEntity(true); } else if (sender == getPhysicalNetworkCustomRB()) { getNeutronPhysicalNetwork().setIsChangeable(true); getDatacenterPhysicalNetwork().setIsChangeable(false); getPhysicalNetworkDatacenter().setEntity(false); } else if (sender == getPhysicalNetworkDatacenter()) { boolean datacenter = getPhysicalNetworkDatacenter().getEntity(); getPhysicalNetworkCustomRB().setEntity(!datacenter, false); getPhysicalNetworkDatacenterRB().setEntity(datacenter, false); } }

Target:
private void onPhysicalRadioButtonChange(Object sender) { boolean datacenter = true; if (sender == getUsePhysicalNetworkFromDatacenter()) { getCustomPhysicalNetwork().setIsChangeable(false); getDatacenterPhysicalNetwork().setIsChangeable(true); datacenter = true; } else if (sender == getUsePhysicalNetworkFromCustom()) { getCustomPhysicalNetwork().setIsChangeable(true); getDatacenterPhysicalNetwork().setIsChangeable(false); datacenter = false; } getUsePhysicalNetworkFromCustom().setEntity(!datacenter, false); getUsePhysicalNetworkFromDatacenter().setEntity(datacenter, false); }
Source:
public ThemeInfo getTheme() { ThemeInfo theme = this.theme; if (theme == null) { synchronized (this) { if (this.theme == null) { theme = loadTheme(); this.theme = theme; } } } if (theme == ThemeInfo.INHERIT) { ProjectState parent = Iterables.getFirst(parents(), null); return parent != null ? parent.getTheme() : null; } return theme; }

Target:
public ThemeInfo getTheme() { ThemeInfo theme = this.theme; if (theme == null) { synchronized (this) { theme = this.theme; if (theme == null) { theme = loadTheme(); this.theme = theme; } } } if (theme == ThemeInfo.INHERIT) { ProjectState parent = Iterables.getFirst(parents(), null); return parent != null ? parent.getTheme() : null; } return theme; }
Source:
private Map<Integer, Map<Integer, File>> sortCbcls(List<File> cbcls) { Map<Integer, Map<Integer, File>> sortedMap = new TreeMap<>(); Pattern pattern = Pattern.compile("^.+C(\\d{1,4}).+L(\\d{1,3})_(\\d).cbcl$"); for (File cbcl : cbcls) { Matcher matcher = pattern.matcher(cbcl.getAbsolutePath()); if (!matcher.matches()) { throw new PicardException("CBCL File " + cbcl.getAbsolutePath() + " does not match expected pattern."); } Integer surface = Integer.valueOf(matcher.group(3)); Integer cycle = Integer.valueOf(matcher.group(1)); if (sortedMap.containsKey(surface)) { sortedMap.get(surface).put(cycle, cbcl); } else { Map<Integer, File> cycleMap = new HashMap<>(); cycleMap.put(cycle, cbcl); sortedMap.put(surface, cycleMap); } } return sortedMap; }

Target:
private Map<Integer, Map<Integer, File>> sortCbcls(List<File> cbcls) { Map<Integer, Map<Integer, File>> sortedMap = new TreeMap<>(); for (File cbcl : cbcls) { Matcher matcher = PATTERN.matcher(cbcl.getAbsolutePath()); if (!matcher.matches()) { throw new PicardException("CBCL File " + cbcl.getAbsolutePath() + " does not match expected pattern."); } Integer surface = Integer.valueOf(matcher.group(3)); Integer cycle = Integer.valueOf(matcher.group(1)); if (sortedMap.containsKey(surface)) { sortedMap.get(surface).put(cycle, cbcl); } else { Map<Integer, File> cycleMap = new HashMap<>(); cycleMap.put(cycle, cbcl); sortedMap.put(surface, cycleMap); } } return sortedMap; }
Source:
long value(long time) { long sum = 0L; long lastTime = time; long minTime = lastTime - windowTimeSize; int pos = nextPos - 1; boolean firstRound = true; while (firstRound || pos != nextPos - 1) { if (pos < 0) { pos = windowDataSize - 1; } if (data[pos].nanoTime < minTime) { sum += (lastTime - minTime) * data[pos].value; break; } sum += (lastTime - data[pos].nanoTime) * data[pos].value; lastTime = data[pos].nanoTime; firstRound = false; pos--; } if (!firstRound && pos == nextPos - 1) { sum += (lastTime - minTime) * data[nextPos].value; } return Math.round((double)sum / (double)windowTimeSize); }

Target:
long value(long time) { long sum = 0L; long lastTime = time; long minTime = lastTime - windowTimeSize; int pos = nextPos - 1; do { if (pos < 0) { pos = windowDataSize - 1; } if (data[pos].nanoTime < minTime) { sum += (lastTime - minTime) * data[pos].value; break; } sum += (lastTime - data[pos].nanoTime) * data[pos].value; lastTime = data[pos].nanoTime; pos--; } while (pos != nextPos - 1); if (pos == nextPos - 1 && data[nextPos].nanoTime > minTime) { sum += (lastTime - minTime) * data[nextPos].value; } return Math.round((double)sum / (double)windowTimeSize); }
Source:
protected boolean isValidConnection(StorageServerConnections conn) { StorageType storageType = conn.getStorageType(); if (storageType == StorageType.NFS && !new NfsMountPointConstraint().isValid(conn.getConnection(), null)) { return failValidation(EngineMessage.VALIDATION_STORAGE_CONNECTION_INVALID); } if (storageType == StorageType.POSIXFS && StringUtils.isEmpty(conn.getVfsType())) { return failValidation(EngineMessage.VALIDATION_STORAGE_CONNECTION_EMPTY_VFSTYPE); } if ((storageType == StorageType.POSIXFS || storageType == StorageType.NFS) && !validate(validateMountOptions())) { return false; } if (storageType == StorageType.ISCSI) { if (StringUtils.isEmpty(conn.getIqn())) { return failValidation(EngineMessage.VALIDATION_STORAGE_CONNECTION_EMPTY_IQN); } if (!isValidStorageConnectionPort(conn.getPort())) { return failValidation(EngineMessage.VALIDATION_STORAGE_CONNECTION_INVALID_PORT); } } if (storageType == StorageType.GLUSTERFS) { StorageConnectionValidator validator = new StorageConnectionValidator(conn); if (!validate(updatePathFromGlusterVolume(conn)) && !validate(validator.canVDSConnectToGlusterfs(getVds()))) { return false; } } if (checkIsConnectionFieldEmpty(conn)) { return false; } return true; }

Target:
protected boolean isValidConnection(StorageServerConnections conn) { StorageType storageType = conn.getStorageType(); if (storageType == StorageType.NFS && !new NfsMountPointConstraint().isValid(conn.getConnection(), null)) { return failValidation(EngineMessage.VALIDATION_STORAGE_CONNECTION_INVALID); } if (storageType == StorageType.POSIXFS && StringUtils.isEmpty(conn.getVfsType())) { return failValidation(EngineMessage.VALIDATION_STORAGE_CONNECTION_EMPTY_VFSTYPE); } if ((storageType == StorageType.POSIXFS || storageType == StorageType.NFS) && !validate(validateMountOptions())) { return false; } if (storageType == StorageType.ISCSI) { if (StringUtils.isEmpty(conn.getIqn())) { return failValidation(EngineMessage.VALIDATION_STORAGE_CONNECTION_EMPTY_IQN); } if (!isValidStorageConnectionPort(conn.getPort())) { return failValidation(EngineMessage.VALIDATION_STORAGE_CONNECTION_INVALID_PORT); } } if (storageType == StorageType.GLUSTERFS) { StorageConnectionValidator validator = new StorageConnectionValidator(conn); if (!validate(validateVolumeIdAndupdatePath(conn)) && !validate(validator.canVDSConnectToGlusterfs(getVds()))) { return false; } } if (checkIsConnectionFieldEmpty(conn)) { return false; } return true; }
Source:
public ServiceInfo(@JsonProperty("name") String name, @JsonProperty("id") String id, @JsonProperty("contactEmail") String contactEmail, @JsonProperty("route") String route, @JsonProperty("extraConfigs") List<String> extraConfigs, @JsonProperty("healthCheck") String healthCheck, @JsonProperty("lbs") List<String> lbs, @JsonProperty("rewriteAppRootTo") String rewriteAppRootTo) { this.name = name; this.id = id; this.contactEmail = contactEmail; this.route = route; this.extraConfigs = Objects.firstNonNull(extraConfigs, Collections.<String>emptyList()); this.healthCheck = healthCheck; this.lbs = lbs; if (rewriteAppRootTo != null) { if (route.substring(route.length() - 1) == "/" && rewriteAppRootTo.substring(rewriteAppRootTo.length() - 1) != "/") { LOG.error(String.format("Provided appRoot %s is absolute, and rewriteAppRootTo %s is not. This will result in a rewrite of %sresource to %sresource", route, rewriteAppRootTo, route, rewriteAppRootTo)); } else if (route.substring(route.length() - 1) != "/" && rewriteAppRootTo.substring(rewriteAppRootTo.length() - 1) == "/") { LOG.error(String.format("Provided appRoot %s is not absolute, and rewriteAppRootTo %s is. This will result in a rewrite of %sresource to %s resource", route, rewriteAppRootTo, route, rewriteAppRootTo)); } else { this.rewriteAppRootTo = rewriteAppRootTo; } } }

Target:
public ServiceInfo(@JsonProperty("name") String name, @JsonProperty("id") String id, @JsonProperty("contactEmail") String contactEmail, @JsonProperty("route") String route, @JsonProperty("extraConfigs") List<String> extraConfigs, @JsonProperty("healthCheck") String healthCheck, @JsonProperty("lbs") List<String> lbs, @JsonProperty("rewriteAppRootTo") String rewriteAppRootTo) { this.name = name; this.id = id; this.contactEmail = contactEmail; this.route = route; this.extraConfigs = Objects.firstNonNull(extraConfigs, Collections.<String>emptyList()); this.healthCheck = healthCheck; this.lbs = lbs; if (rewriteAppRootTo != null) { if (isAbsoluteURI(route) && ! isAbsoluteURI(rewriteAppRootTo)) { LOG.error(String.format("Provided appRoot %s is absolute, and rewriteAppRootTo %s is not. This will result in a rewrite of %sresource to %sresource", route, rewriteAppRootTo, route, rewriteAppRootTo)); } else if (! isAbsoluteURI(route) && isAbsoluteURI(rewriteAppRootTo)) { LOG.error(String.format("Provided appRoot %s is not absolute, and rewriteAppRootTo %s is. This will result in a rewrite of %sresource to %s resource", route, rewriteAppRootTo, route, rewriteAppRootTo)); } else { this.rewriteAppRootTo = rewriteAppRootTo; } } }
Source:
protected void handleMessage(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessage responseMessage, final OsgpException osgpException) { if (responseMessage.getDataObject() instanceof ArrayList) { final List<FirmwareVersionDto> firmwareVersionList = (List<FirmwareVersionDto>) responseMessage .getDataObject(); this.configurationService.handleGetFirmwareVersionResponse(deviceMessageMetadata, responseMessage.getResult(), osgpException, firmwareVersionList); } }

Target:
protected void handleMessage(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessage responseMessage, final OsgpException osgpException) throws FunctionalException { if (responseMessage.getDataObject() instanceof ArrayList) { final List<FirmwareVersionDto> firmwareVersionList = (List<FirmwareVersionDto>) responseMessage .getDataObject(); this.configurationService.handleGetFirmwareVersionResponse(deviceMessageMetadata, responseMessage.getResult(), osgpException, firmwareVersionList); } else { throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.DOMAIN_SMART_METERING, new OsgpException(ComponentType.DOMAIN_SMART_METERING, "DataObject for response message should be of type ArrayList")); } }
Source:
protected void dispatchFinalAggregations(PendingOpsRequest request) { VoltTable digestScanResults = request.aggregateTables[0]; VoltTable scanResults = request.aggregateTables[2]; Map<String, Snapshot> aggregates = new HashMap<String, Snapshot>(); while (scanResults.advanceRow()) { if (scanResults.getString("RESULT").equals("SUCCESS") && scanResults.getString("READABLE").equals("TRUE") && scanResults.getString("COMPLETED").equals("TRUE")) { hashToSnapshot(scanResults, aggregates); } } while (digestScanResults.advanceRow()) { if (digestScanResults.getString("RESULT").equals("SUCCESS")) { hashDigestToSnapshot(digestScanResults, aggregates); } } List<ClientResultRow> clientResults = new ArrayList<ClientResultRow>(); for (Snapshot s : aggregates.values()) { clientResults.add(new ClientResultRow( (String)s.asRow()[0], (String)s.asRow()[1], (String)s.asRow()[2], (long)s.asRow()[3], (long)s.asRow()[4], (long)s.asRow()[5], (String)s.asRow()[6], (String)s.asRow()[7], (String)s.asRow()[8], (String)s.asRow()[9] )); } Collections.sort(clientResults, new Comparator<ClientResultRow>() { @Override public int compare(ClientResultRow r1, ClientResultRow r2) { return r1.compareTo(r2); } }); VoltTable clientSortedResults = constructClientResultsTable(); for (ClientResultRow row : clientResults) { clientSortedResults.addRow( row.path, row.pathType, row.nonce, row.txnid, row.created, row.size, row.tablesRequired, row.tablesMissing, row.tablesIncomplete, row.complete ); } request.aggregateTables[0] = clientSortedResults; }

Target:
protected void dispatchFinalAggregations(PendingOpsRequest request) { VoltTable digestScanResults = request.aggregateTables[0]; VoltTable scanResults = request.aggregateTables[2]; Map<String, Snapshot> aggregates = new HashMap<String, Snapshot>(); while (scanResults.advanceRow()) { if (scanResults.getString("RESULT").equals("SUCCESS") && scanResults.getString("READABLE").equals("TRUE") && scanResults.getString("COMPLETED").equals("TRUE")) { hashToSnapshot(scanResults, aggregates); } } while (digestScanResults.advanceRow()) { if (digestScanResults.getString("RESULT").equals("SUCCESS")) { hashDigestToSnapshot(digestScanResults, aggregates); } } List<ClientResultRow> clientResults = new ArrayList<ClientResultRow>(); for (Snapshot s : aggregates.values()) { Object row[] = s.asRow(); clientResults.add(new ClientResultRow( (String)row[0], (String)row[1], (String)row[2], (long)row[3], (long)row[4], (long)row[5], (String)row[6], (String)row[7], (String)row[8], (String)row[9] )); } Collections.sort(clientResults, new Comparator<ClientResultRow>() { @Override public int compare(ClientResultRow r1, ClientResultRow r2) { return r1.compareTo(r2); } }); VoltTable clientSortedResults = constructClientResultsTable(); for (ClientResultRow row : clientResults) { clientSortedResults.addRow( row.path, row.pathType, row.nonce, row.txnid, row.created, row.size, row.tablesRequired, row.tablesMissing, row.tablesIncomplete, row.complete ); } request.aggregateTables[0] = clientSortedResults; }
Source:
private boolean roughlyEveryTenthTime() { return currentTimeMillis() % 10 == 0; }

Target:
private boolean roughlyEveryTenthTime() { return rnd.nextInt(10) == 0; }
Source:
private void showSpeedDialIfAnyChecked() { if (checkedIds.size() > 0) { mSpeedDialView.show(); } else { mSpeedDialView.hide(); } }

Target:
private void showSpeedDialIfAnyChecked() { if (checkedIds.size() > 0) { if (!mSpeedDialView.isShown()) { mSpeedDialView.show(); } } else { mSpeedDialView.hide(); } }
Source:
protected void executeCommand() { ScanDiskAlignmentVDSCommandParameters parameters; final VM vm = getVms().get(0); final Guid storagePoolId = vm.getStoragePoolId(); acquireDiskLocks(); if (getDiskType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) getDisk(); ScanDiskImageAlignmentVDSCommandParameters imageParameters = new ScanDiskImageAlignmentVDSCommandParameters( getVdsInPool(storagePoolId), vm.getId()); imageParameters.setPoolId(storagePoolId); imageParameters.setDomainId(diskImage.getStorageIds().get(0)); imageParameters.setImageGroupId(diskImage.getimage_group_id()); imageParameters.setImageId(diskImage.getImageId()); parameters = imageParameters; } else if (getDiskType() == DiskStorageType.LUN) { LunDisk lunDisk = (LunDisk) getDisk(); ScanDiskLunAlignmentVDSCommandParameters lunParameters = new ScanDiskLunAlignmentVDSCommandParameters( getVdsInPool(storagePoolId), vm.getId()); lunParameters.setLunGuid(lunDisk.getLun().getLUN_id()); parameters = lunParameters; } else { throw new RuntimeException("Unknown DiskStorageType " + getDiskType().toString()); } Boolean isDiskAligned = (Boolean) getBackend().getResourceManager() .RunVdsCommand(VDSCommandType.ScanDiskAlignment, parameters).getReturnValue(); getDisk().setAlignment(isDiskAligned ? DiskAlignment.Aligned : DiskAlignment.Misaligned); getDisk().setLastAlignmentScan(new Date()); getBaseDiskDao().update(getDisk()); setSucceeded(true); releaseDiskLocks(); }

Target:
protected void executeCommand() { ScanDiskAlignmentVDSCommandParameters parameters; acquireDiskLocks(); if (getDiskType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) getDisk(); ScanDiskImageAlignmentVDSCommandParameters imageParameters = new ScanDiskImageAlignmentVDSCommandParameters(getVdsIdInPool(), getVm().getId()); imageParameters.setPoolId(getStoragePoolId()); imageParameters.setDomainId(diskImage.getStorageIds().get(0)); imageParameters.setImageGroupId(diskImage.getimage_group_id()); imageParameters.setImageId(diskImage.getImageId()); parameters = imageParameters; } else if (getDiskType() == DiskStorageType.LUN) { LunDisk lunDisk = (LunDisk) getDisk(); ScanDiskLunAlignmentVDSCommandParameters lunParameters = new ScanDiskLunAlignmentVDSCommandParameters(getVdsIdInPool(), getVm().getId()); lunParameters.setLunGuid(lunDisk.getLun().getLUN_id()); parameters = lunParameters; } else { throw new RuntimeException("Unknown DiskStorageType " + getDiskType().toString()); } Boolean isDiskAligned = (Boolean) runVdsCommand( VDSCommandType.ScanDiskAlignment, parameters).getReturnValue(); getDisk().setAlignment(isDiskAligned ? DiskAlignment.Aligned : DiskAlignment.Misaligned); getDisk().setLastAlignmentScan(new Date()); getBaseDiskDao().update(getDisk()); setSucceeded(true); releaseDiskLocks(); }
Source:
protected CompletableFuture<Void> respondToRequest(ChannelHandlerContext ctx, HttpRequest httpRequest, HandlerRequest<EmptyRequestBody, M> handlerRequest, RestfulGateway gateway) { File file = getFile(handlerRequest); if (file != null && file.exists()) { return CompletableFuture.completedFuture(file).thenAcceptAsync(logFile -> { try { HandlerUtils.transferFile( ctx, logFile, httpRequest); } catch (FlinkException e) { throw new CompletionException(new FlinkException("Could not transfer file to client.", e)); } }); } else { throw new CompletionException(new RestHandlerException( "This file is not exist in JobManager log dir.", HttpResponseStatus.NOT_FOUND)); } }

Target:
protected CompletableFuture<Void> respondToRequest(ChannelHandlerContext ctx, HttpRequest httpRequest, HandlerRequest<EmptyRequestBody, M> handlerRequest, RestfulGateway gateway) { File file = getFile(handlerRequest); if (file != null && file.exists()) { try { HandlerUtils.transferFile( ctx, file, httpRequest); } catch (FlinkException e) { throw new CompletionException(new FlinkException("Could not transfer file to client.", e)); } return CompletableFuture.completedFuture(null); } else { return HandlerUtils.sendErrorResponse( ctx, httpRequest, new ErrorResponseBody("This file does not exist in JobManager log dir."), HttpResponseStatus.NOT_FOUND, Collections.emptyMap()); } }
Source:
public HttpRequest(HttpMethod httpMethod, String url) { this.httpMethod = httpMethod; try { this.url = new URL(url); } catch (MalformedURLException e) { throw logger.logExceptionAsWarning(new IllegalArgumentException("'url' must be a valid URL")); } this.headers = new HttpHeaders(); }

Target:
public HttpRequest(HttpMethod httpMethod, String url) { this.httpMethod = httpMethod; try { this.url = new URL(url); } catch (MalformedURLException ex) { throw logger.logExceptionAsWarning(new IllegalArgumentException("'url' must be a valid URL", ex)); } this.headers = new HttpHeaders(); }
Source:
public void execute( Runnable runnable ) { if ( latch.compareAndSet( false, true ) ) { jobScheduler.schedule( group, () -> { runnable.run(); latch.set( false ); } ); } }

Target:
public void execute( Runnable runnable ) { if ( latch.compareAndSet( false, true ) ) { jobScheduler.schedule( group, () -> { try { runnable.run(); } finally { latch.set( false ); } } ); } }
Source:
public void isReachableFalse() { target = new SocketUrlDetection(9999); boolean actual = target.isReachable(); assertFalse(actual); }

Target:
public void isReachableFalse() { target = new SocketUrlDetection(HOPEFULLY_UNUSED_PORT); boolean actual = target.isReachable(); assertFalse(actual); }
Source:
public void execute(final MapActivity activity) { final GpxSelectionHelper selectedGpxHelper = activity.getMyApplication() .getSelectedGpxHelper(); if (selectedGpxHelper.isShowingAnyGpxFiles()) { selectedGpxHelper.clearAllGpxFileToShow(); } else { selectedGpxHelper.restoreSelectedGpxFiles(); final File dir = activity.getMyApplication().getAppPath(IndexConstants.GPX_INDEX_DIR); CallbackWithObject<GPXFile[]> callbackWithObject = new CallbackWithObject<GPXFile[]>() { @Override public boolean processResult(GPXFile[] result) { return true; } }; selectedGpxHelper.restoreSelectedGpxFiles(); List<GpxSelectionHelper.SelectedGpxFile> selectedGpxFiles = selectedGpxHelper .getSelectedGPXFiles(); List<String> files = new ArrayList<>(); for (GpxSelectionHelper.SelectedGpxFile file : selectedGpxFiles) { files.add(file.getGpxFile().path.substring(file.getGpxFile().path.lastIndexOf("/"))); } GpxUiHelper.loadFileInDifferentThread(activity, callbackWithObject, dir, files.toArray(new String[files.size()])); } }

Target:
public void execute(final MapActivity activity) { final GpxSelectionHelper selectedGpxHelper = activity.getMyApplication() .getSelectedGpxHelper(); if (selectedGpxHelper.isShowingAnyGpxFiles()) { selectedGpxHelper.clearAllGpxFileToShow(); } else { selectedGpxHelper.restoreSelectedGpxFiles(); } }
Source:
private void validate() { if ( ! hasAuthenticationHandler ) { if ( authenticateUser ) Fuseki.configLog.warn("Authetication iof users required (e.g. 'allowedUsers' is set) but there is no authentication setup (e.g. password file)"); if ( hasDataAccessControl ) Fuseki.configLog.warn("Data-level access control in the configuration but there is no authentication setup (e.g. password file)"); } }

Target:
private void validate() { if ( ! hasAuthenticationHandler ) { if ( authenticateUser ) Fuseki.configLog.warn("Authetication of users required (e.g. 'allowedUsers' is set) but there is no authentication setup (e.g. password file)"); if ( hasDataAccessControl ) Fuseki.configLog.warn("Data-level access control in the configuration but there is no authentication setup (e.g. password file)"); } }
Source:
public boolean equals( final Object o ) { if ( this == o ) { return true; } if ( !( o instanceof DependencyPathSelectedEvent ) ) { return false; } final DependencyPathSelectedEvent that = (DependencyPathSelectedEvent) o; if ( !context.equals( that.context ) ) { return false; } if (!isSelected == that.isSelected) { return false; } return path.equals( that.path ); }

Target:
public boolean equals( final Object o ) { if ( this == o ) { return true; } if ( !( o instanceof DependencyPathSelectedEvent ) ) { return false; } final DependencyPathSelectedEvent that = (DependencyPathSelectedEvent) o; if ( !context.equals( that.context ) ) { return false; } return path.equals( that.path ); }
Source:
public void testConfigureFetchAfterCloneTask() throws Exception { createNoteInOrigin(); URIish uri = new URIish("file:/ + repository1.getRepository().getDirectory().toString()); CloneOperation clop = new CloneOperation(uri, true, null, workdir2, "refs/heads/master", "origin", 0); clop.addPostCloneTask(new ConfigureFetchAfterCloneTask("origin", "refs/notes/review:refs/notes/review")); clop.run(null); Repository clonedRepo = FileRepositoryBuilder.create(new File(workdir2, Constants.DOT_GIT)); assertTrue( clonedRepo.getConfig() .getStringList(ConfigConstants.CONFIG_REMOTE_SECTION, "origin", "fetch")[1].equals("refs/notes/review:refs/notes/review")); Git clonedGit = new Git(clonedRepo); assertEquals(1, clonedGit.notesList().setNotesRef("refs/notes/review").call().size()); clonedGit.getRepository().close(); }

Target:
public void testConfigureFetchAfterCloneTask() throws Exception { createNoteInOrigin(); URIish uri = new URIish("file:/ + repository1.getRepository().getDirectory().toString()); CloneOperation clop = new CloneOperation(uri, true, null, workdir2, "refs/heads/master", "origin", 0); clop.addPostCloneTask(new ConfigureFetchAfterCloneTask("origin", "refs/notes/review:refs/notes/review")); clop.run(null); Repository clonedRepo = FileRepositoryBuilder.create(new File(workdir2, Constants.DOT_GIT)); assertTrue( clonedRepo.getConfig() .getStringList(ConfigConstants.CONFIG_REMOTE_SECTION, "origin", "fetch")[1].equals("refs/notes/review:refs/notes/review")); Git clonedGit = new Git(clonedRepo); assertEquals(1, clonedGit.notesList().setNotesRef("refs/notes/review").call().size()); clonedGit.close(); }
Source:
private Path getXDGConfigHome(FS fs) { String configHomePath = getenv(Constants.XDG_CONFIG_HOME); if (StringUtils.isEmptyOrNull(configHomePath)) { configHomePath = new File(fs.userHome(), ".config") .getAbsolutePath(); } Path xdgHomePath = null; try { xdgHomePath = Paths.get(configHomePath); Files.createDirectories(xdgHomePath); return xdgHomePath; } catch (IOException | InvalidPathException e) { LOG.error(JGitText.get().createXDGConfigHomeFailed, xdgHomePath, e); } return null; }

Target:
private Path getXDGConfigHome(FS fs) { String configHomePath = getenv(Constants.XDG_CONFIG_HOME); if (StringUtils.isEmptyOrNull(configHomePath)) { configHomePath = new File(fs.userHome(), ".config") .getAbsolutePath(); } try { Path xdgHomePath = Paths.get(configHomePath); Files.createDirectories(xdgHomePath); return xdgHomePath; } catch (IOException | InvalidPathException e) { LOG.error(JGitText.get().createXDGConfigHomeFailed, configHomePath, e); } return null; }
Source:
protected double convertDuration(double duration) { return duration / durationFactor; LOG.error("Exception thrown from {}#report. Exception was suppressed.", ScheduledReporter.this.getClass().getSimpleName(), ex); }

Target:
protected double convertDuration(double duration) { return duration / durationFactor; }
Source:
private void registerOpenWorkspaceVersion(MenuManager menu, final ISelectionProvider selectionProvider) { menu.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { if (!(selectionProvider instanceof SourceViewer)) { return; } Action action = new Action(Messages.Compare_OpenFile) { @Override public void run() { Object editorInput = ((SourceViewer) selectionProvider).getInput(); if (!(editorInput instanceof CommentableCompareItem)) { return; } FileInfo fileShown = ((CommentableCompareItem) editorInput).getFileInfo(); if (fileShown == null) { return; } int selectedLine = 0; if (selectionProvider.getSelection() instanceof ITextSelection) { ITextSelection selection = (ITextSelection) selectionProvider.getSelection(); selectedLine = selection.getStartLine(); } boolean openSucceeded = UIUtils.openSingleFile(fileShown, gerritClient, fileShown.getRevision(), selectedLine); if (!openSucceeded) { UIUtils.displayInformation(Messages.UIFilesTable_3, Messages.UIFilesTable_2 + '\n' + fileShown.getPath()); } } }; manager.insertAfter("file", action); } }); }

Target:
private void registerOpenWorkspaceVersion(MenuManager menu, final ISelectionProvider selectionProvider) { menu.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { if (!(selectionProvider instanceof SourceViewer)) { return; } manager.insertAfter("file", new OpenWorkspaceFile((SourceViewer) selectionProvider, gerritClient)); } }); }
Source:
public HttpPostMultipartRequestDecoder offer(HttpContent content) { checkDestroyed(); if (content instanceof LastHttpContent) { isLastChunk = true; } ByteBuf buf = content.content(); if (undecodedChunk == null) { undecodedChunk = isLastChunk ? buf.retain() : buf.copy(); } else { undecodedChunk.writeBytes(buf); } parseBody(); if (undecodedChunk != null && undecodedChunk.writerIndex() > discardThreshold) { undecodedChunk.discardReadBytes(); } return this; }

Target:
public HttpPostMultipartRequestDecoder offer(HttpContent content) { checkDestroyed(); if (content instanceof LastHttpContent) { isLastChunk = true; } ByteBuf buf = content.content(); if (undecodedChunk == null) { undecodedChunk = isLastChunk ? buf.retainedSlice() : buf.copy(); } else { undecodedChunk.writeBytes(buf); } parseBody(); if (undecodedChunk != null && undecodedChunk.writerIndex() > discardThreshold) { undecodedChunk.discardReadBytes(); } return this; }
Source:
public <T extends Event> boolean removeListener(EventListener<T> listener) { return eventListenerMap.values().remove(listener); }

Target:
public <T extends Event> boolean removeListener(EventListener<T> listener) { boolean result = false; for (List<EventListener<?>> eventListenerList : eventListenerMap.values()) { result = result || eventListenerList.remove(listener); } return result; }
Source:
@Test public void testPushAggregateThroughtOuterJoin7() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateJoinTransposeRule.EXTENDED) .build(); final String sql = "select e.job\n" + "from (select * from sales.emp where empno = 10) as e\n" + "join sales.dept as d on e.job = d.name\n" + "and e.deptno + e.empno = d.deptno + 5\n" + "group by e.job"; checkPlanning(tester, preProgram, new HepPlanner(program), sql); }

Target:
@Test public void testPushAggregateThroughtOuterJoin7() { final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(AggregateProjectMergeRule.INSTANCE) .build(); final HepProgram program = new HepProgramBuilder() .addRuleInstance(AggregateJoinTransposeRule.EXTENDED) .build(); final String sql = "select e.job\n" + "from (select * from sales.emp where empno = 10) as e\n" + "left outer join sales.dept as d on e.job = d.name\n" + "and e.deptno + e.empno = d.deptno + 5\n" + "group by e.job"; checkPlanning(tester, preProgram, new HepPlanner(program), sql); }
Source:
public String getStatus() { if (get(POD_DELETION_TIMESTAMP).isDefined()) { return "Terminating"; } ModelNode node = get(POD_STATUS_CONTAINER_STATUSES); if (node.getType() == ModelType.LIST) { for (ModelNode containerStatus : node.asList()) { for (String containerReason: POD_STATUS_CONTAINER_STATES.keySet()) { String status = getContainerStatusIfDefined( containerStatus, containerReason, POD_STATUS_CONTAINER_STATES.get(containerReason)); if (status != null) { return status; } } } } return get(POD_STATUS_REASON).isDefined() ? asString(POD_STATUS_REASON) : asString(POD_STATUS_PHASE); }

Target:
public String getStatus() { if (has(POD_DELETION_TIMESTAMP)) { return "Terminating"; } ModelNode node = get(POD_STATUS_CONTAINER_STATUSES); if (node.getType() == ModelType.LIST) { for (ModelNode containerStatus : node.asList()) { String status = getContainerStatusStringIfExist(containerStatus); if (status != null) { return status; } } } return has(POD_STATUS_REASON) ? asString(POD_STATUS_REASON) : asString(POD_STATUS_PHASE); }
Source:
protected void addResourceMetadatasElement(Element attributeElement) { if (null == this.getMetadatas() || this.getMetadatas().isEmpty()) { return; } Element metadatasElement = new Element("metadatas"); this.getMetadatas().keySet().stream().forEach(key -> { if (null != key) { Map<String, String> map = this.getMetadatas().get(key); map.keySet().stream().forEach(langCode -> { Element metadataElement = new Element("metadata"); metadataElement.setAttribute("key", key); metadataElement.setAttribute("lang", langCode); metadataElement.setText(map.get(langCode).trim()); metadatasElement.addContent(metadataElement); }); } }); attributeElement.addContent(metadatasElement); }

Target:
protected void addResourceMetadatasElement(Element attributeElement) { if (null == this.getMetadatas() || this.getMetadatas().isEmpty()) { return; } Element metadatasElement = new Element("metadatas"); this.getMetadatas().keySet().stream().forEach(key -> { Map<String, String> map = this.getMetadatas().get(key); map.keySet().stream().forEach(langCode -> { Element metadataElement = new Element("metadata"); metadataElement.setAttribute("key", key); metadataElement.setAttribute("lang", langCode); metadataElement.setText(map.get(langCode).trim()); metadatasElement.addContent(metadataElement); }); }); attributeElement.addContent(metadatasElement); }
Source:
Element getSelectPicker() { return getElement().querySelector("[data-field=\"time-zone-selector\"]"); }

Target:
Element getSelectPicker() { return this.timeZoneSelector; }
Source:
protected MutableBoundedValue<Short> constructValue(Short actualValue) { return SpongeValueFactory.boundedBuilder(Keys.SPAWNER_REQUIRED_PLAYER_RANGE) .minimum((short) 0) .maximum(Short.MAX_VALUE) .defaultValue(DataConstants.DEFAULT_SPAWNER_REQUIRED_PLAYER_RANGE) .actualValue(actualValue) .build(); }

Target:
protected MutableBoundedValue<Short> constructValue(Short actualValue) { return SpongeValueFactory.boundedBuilder(this.key) .minimum((short) 0) .maximum(Short.MAX_VALUE) .defaultValue(DataConstants.DEFAULT_SPAWNER_REQUIRED_PLAYER_RANGE) .actualValue(actualValue) .build(); }