auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private CompletionStage<RestResponse> getStats(RestRequest request) { NettyRestResponse.Builder responseBuilder = checkCacheManager(request); if (responseBuilder.getHttpStatus() == NOT_FOUND) return completedFuture(responseBuilder.build()); CacheContainerStats containerStats = Security.doAs(request.getSubject(), (PrivilegedAction<CacheContainerStats>) () -> cacheManager.getStats()); try { byte[] bytes = objectMapper.writeValueAsBytes(containerStats); responseBuilder.contentType(APPLICATION_JSON) .entity(bytes) .status(OK); } catch (JsonProcessingException e) { responseBuilder.status(HttpResponseStatus.INTERNAL_SERVER_ERROR); } return completedFuture(responseBuilder.build()); }

Target:
private CompletionStage<RestResponse> getStats(RestRequest request) { NettyRestResponse.Builder responseBuilder = checkCacheManager(request); if (responseBuilder.getHttpStatus() == NOT_FOUND) return completedFuture(responseBuilder.build()); CacheContainerStats stats = cacheManager.getStats(); try { byte[] bytes = objectMapper.writeValueAsBytes(stats); responseBuilder.contentType(APPLICATION_JSON) .entity(bytes) .status(OK); } catch (JsonProcessingException e) { responseBuilder.status(HttpResponseStatus.INTERNAL_SERVER_ERROR); } return completedFuture(responseBuilder.build()); }
Source:
private static Object literalValue(RexLiteral literal) { Comparable value = RexLiteral.value(literal); String dateTimeFormatISO = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; switch (literal.getTypeName()) { case TIMESTAMP: case TIMESTAMP_WITH_LOCAL_TIME_ZONE: assert value instanceof TimestampString; final SimpleDateFormat dateFormatter = new SimpleDateFormat(dateTimeFormatISO, Locale.ROOT); dateFormatter.setTimeZone(DateTimeUtils.UTC_ZONE); return dateFormatter.format(literal.getValue2()); case DATE: assert value instanceof DateString; return value.toString(); default: return literal.getValue3(); } }

Target:
private static Object literalValue(RexLiteral literal) { Comparable value = RexLiteral.value(literal); switch (literal.getTypeName()) { case TIMESTAMP: case TIMESTAMP_WITH_LOCAL_TIME_ZONE: assert value instanceof TimestampString; final SimpleDateFormat dateFormatter = getDateFormatter(ISO_DATETIME_FRACTIONAL_SECOND_FORMAT); return dateFormatter.format(literal.getValue2()); case DATE: assert value instanceof DateString; return value.toString(); default: return literal.getValue3(); } }
Source:
private void validate() { boolean remote = (fFlags & REMOTE) > 0; StringBuilder sb = new StringBuilder(); String hostBinary = fHostBinaryText.getText().trim(); if ( hostBinary.isEmpty() ) { sb.append( ( remote ) ? Messages.GdbDebugNewExecutableCommand_Host_binary_must_be_specified : Messages.GdbDebugNewExecutableCommand_Binary_must_be_specified ); } else { File file = new File( hostBinary ); if ( !file.exists() ) { sb.append( ( remote ) ? Messages.GdbDebugNewExecutableCommand_Host_binary_file_does_not_exist : Messages.GdbDebugNewExecutableCommand_Binary_file_does_not_exist ); } else if ( file.isDirectory() ) { sb.append( ( remote ) ? Messages.GdbDebugNewExecutableCommand_Invalid_host_binary : Messages.GdbDebugNewExecutableCommand_Invalid_binary ); } } if ( fTargetBinaryText != null ) { if ( fTargetBinaryText.getText().trim().length() == 0 ) { if ( sb.length() != 0 ) { sb.append('\n'); } sb.append( Messages.GdbDebugNewExecutableCommand_Binary_on_target_must_be_specified ); } } setErrorMessage( ( sb.length() != 0 ) ? sb.toString() : null ); getButton( IDialogConstants.OK_ID ).setEnabled( getErrorMessage() == null ); }

Target:
private void validate() { boolean remote = (fFlags & REMOTE) > 0; StringBuilder sb = new StringBuilder(); String hostBinary = fHostBinaryText.getText().trim(); if ( hostBinary.isEmpty() ) { sb.append( ( remote ) ? Messages.GdbDebugNewExecutableCommand_Host_binary_must_be_specified : Messages.GdbDebugNewExecutableCommand_Binary_must_be_specified ); } else { File file = new File( hostBinary ); if ( !file.exists() ) { sb.append( ( remote ) ? Messages.GdbDebugNewExecutableCommand_Host_binary_file_does_not_exist : Messages.GdbDebugNewExecutableCommand_Binary_file_does_not_exist ); } else if ( file.isDirectory() ) { sb.append( ( remote ) ? Messages.GdbDebugNewExecutableCommand_Invalid_host_binary : Messages.GdbDebugNewExecutableCommand_Invalid_binary ); } } if ( fTargetBinaryText != null ) { if ( fTargetBinaryText.getText().trim().length() == 0 ) { if ( sb.length() != 0 ) { sb.append( "\n " ); } sb.append( Messages.GdbDebugNewExecutableCommand_Binary_on_target_must_be_specified ); } } setErrorMessage( ( sb.length() != 0 ) ? sb.toString() : null ); getButton( IDialogConstants.OK_ID ).setEnabled( getErrorMessage() == null ); }
Source:
private Map<String, String> parseParameters(String rawParameters) { Map<String, String> result; Properties properties = new Properties(); try { properties.load(new StringReader(rawParameters)); result = new HashMap<>(); for (String key : properties.stringPropertyNames()) { if (!Objects.equals(key, "")) { result.put(key, properties.getProperty(key)); } } } catch (IOException e) { result = new HashMap<>(); } return result; }

Target:
private Properties parseParameters(String rawParameters) { Properties properties = new Properties(); try { properties.load(new StringReader(rawParameters)); } catch (IOException e) { LOGGER.warn("Failed to parse UIX parameters [{}]. Cause [{}].", rawParameters, ExceptionUtils.getRootCauseMessage(e)); } return properties; }
Source:
public synchronized MethodInfo postLoadMethodOrNull() { if (isPostLoadMethodMapped) { return postLoadMethod; } Collection<MethodInfo> possiblePostLoadMethods = methodsInfo.findMethodInfoBy(methodInfo -> methodInfo.hasAnnotation(PostLoad.class)); if(possiblePostLoadMethods.size() > 1) { throw new MetadataException(String.format("Cannot have more than one post load method annotated with @PostLoad for class '%s'", this.className)); } this.postLoadMethod = possiblePostLoadMethods.stream().findFirst().orElse(null); return postLoadMethod; }

Target:
public synchronized MethodInfo postLoadMethodOrNull() { initPostLoadMethod(); return postLoadMethod; }
Source:
public boolean hasNext() { return nextIndex() < fEnd; }

Target:
public boolean hasNext() { return nextIndex() < fList.size(); }
Source:
public void profileChangeFingerprint(WebContext ctx) { U userAccount = getUser().getUserObject(getUserClass()); userAccount = userAccount.getMapper().refreshOrFail(userAccount); assertNotNew(userAccount); userAccount.getUserAccountData().getLogin().resetFingerprint(); userAccount.getMapper().update(userAccount); ctx.respondWith().redirectToGet("/profile"); }

Target:
public void profileChangeFingerprint(WebContext ctx) { U userAccount = getUser().getUserObject(getUserClass()); userAccount = userAccount.getMapper().refreshOrFail(userAccount); assertNotNew(userAccount); userAccount.getUserAccountData().getLogin().resetFingerprint(); userAccount.getMapper().update(userAccount); ctx.respondWith().redirectToGet(wondergemRoot); }
Source:
private void loadAndPut(String environment) throws IOException { String name = "/" + environment + ".properties"; InputStream stream = DefaultEnvironment.class.getResourceAsStream(name); Properties properties = new Properties(); if (stream != null) { properties.load(stream); this.properties.putAll(properties); } else { LOG.warn("Could not find the file '%s.properties' to load. If you ask for any property, null will be returned", environment); } }

Target:
private void loadAndPut(String environment) throws IOException { String name = "/" + environment + ".properties"; InputStream stream = DefaultEnvironment.class.getResourceAsStream(name); Properties properties = new Properties(); if (stream != null) { properties.load(stream); this.properties.putAll(properties); } else { LOG.warn( "Could not find the file '{}.properties' to load. If you ask for any property, null will be returned", environment); } }
Source:
void addCommand(String name, String command) { if (commands == null) { commands = Maps.newHashMap(); } commands.put(name, command); }

Target:
void addCommand(String name, String command) { if (commands == null) { commands = Maps.newTreeMap(); } commands.put(name, command); }
Source:
private String getDataStoreName() { try { final TenantContext tenantContext = _tenantContextFactory.getContext(tenant); final JobContext jobContext = tenantContext.getJob(job); final String jobFileName = jobContext.getJobFile().getName(); final RepositoryFile jobRepositoryFile = tenantContext.getTenantRootFolder().getFolder("jobs") .getFile(jobFileName); final JaxbJobReader reader = new JaxbJobReader(tenantContext.getConfiguration()); final File jobFile = new File(jobRepositoryFile.toResource().getQualifiedPath()); return reader.readMetadata(jobFile).getDatastoreName(); } catch (RuntimeException e) { logger.error("DataStore name could not be resolved. {}", e); return null; } }

Target:
private String getDataStoreName() { try { final File jobFile = getJobFile(); final TenantContext tenantContext = _tenantContextFactory.getContext(tenant); final JaxbJobReader reader = new JaxbJobReader(tenantContext.getConfiguration()); return reader.readMetadata(jobFile).getDatastoreName(); } catch (RuntimeException e) { logger.warn("DataStore name could not be resolved. {}", e); return null; } }
Source:
public void checkSpecificAccessControl() { String questionId = getRequestParamValue(Const.ParamsNames.FEEDBACK_QUESTION_ID); if (questionId != null) { FeedbackQuestionAttributes feedbackQuestionAttributes = logic.getFeedbackQuestion(questionId); FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession( feedbackQuestionAttributes.getFeedbackSessionName(), feedbackQuestionAttributes.getCourseId()); gateKeeper.verifyAccessible( logic.getInstructorForGoogleId(feedbackQuestionAttributes.getCourseId(), userInfo.getId()), feedbackSession); return; } String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); if (feedbackSessionName == null) { gateKeeper.verifyAccessible( logic.getInstructorForGoogleId(courseId, userInfo.getId()), logic.getCourse(courseId)); } else { gateKeeper.verifyAccessible( logic.getInstructorForGoogleId(courseId, userInfo.id), logic.getFeedbackSession(feedbackSessionName, courseId)); } }

Target:
public void checkSpecificAccessControl() { String questionId = getRequestParamValue(Const.ParamsNames.FEEDBACK_QUESTION_ID); if (questionId != null) { FeedbackQuestionAttributes feedbackQuestionAttributes = logic.getFeedbackQuestion(questionId); FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession( feedbackQuestionAttributes.getFeedbackSessionName(), feedbackQuestionAttributes.getCourseId()); gateKeeper.verifyAccessible( logic.getInstructorForGoogleId(feedbackQuestionAttributes.getCourseId(), userInfo.getId()), feedbackSession); return; } String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); if (courseId != null) { gateKeeper.verifyAccessible( logic.getInstructorForGoogleId(courseId, userInfo.getId()), logic.getCourse(courseId)); } }
Source:
private List<ElasticsearchVertex> getElasticsearchVertices(SearchHits hits, FetchHints fetchHints, Authorizations authorizations) { return StreamUtils.stream(hits) .map(hit -> { String elementId = hit.getField(Elasticsearch5SearchIndex.ELEMENT_ID_FIELD_NAME).getValue(); return new ElasticsearchVertex( getGraph(), elementId, fetchHints, authorizations ); }).collect(Collectors.toList()); }

Target:
private List<ElasticsearchVertex> getElasticsearchVertices(SearchHits hits, FetchHints fetchHints, Authorizations authorizations) { return stream(hits) .map(hit -> { String elementId = hit.getField(Elasticsearch5SearchIndex.ELEMENT_ID_FIELD_NAME).getValue(); return new ElasticsearchVertex( getGraph(), elementId, fetchHints, authorizations ); }).collect(Collectors.toList()); }
Source:
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException { isEqOp = ExtUtil.readBool(in); readExpressions(in, pf); if (isEqOp) { op = XPathEqExpr.EQ; } else { op = XPathEqExpr.NEQ; } computedCacheability = ExtUtil.readBool(in); exprIsCacheable = ExtUtil.readBool(in); computedContextTypes = ExtUtil.readBool(in); contextRefIsRelevant = ExtUtil.readBool(in); originalContextRefIsRelevant = ExtUtil.readBool(in); }

Target:
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException { isEqOp = ExtUtil.readBool(in); readExpressions(in, pf); if (isEqOp) { op = XPathEqExpr.EQ; } else { op = XPathEqExpr.NEQ; } cacheState = (CacheableExprState)ExtUtil.read(in, CacheableExprState.class, pf); }
Source:
public static Predicate<Unit> unitIsOwnedAndMatchesTypeAndNotTransporting( final GamePlayer player, final UnitType unitType) { return Matches.unitIsOwnedBy(player) .and(Matches.unitIsOfType(unitType)) .and(Unit::isTransporting); }

Target:
public static Predicate<Unit> unitIsOwnedAndMatchesTypeAndNotTransporting( final GamePlayer player, final UnitType unitType) { return Matches.unitIsOwnedBy(player) .and(Matches.unitIsOfType(unitType)) .and(Predicate.not(Unit::isTransporting)); }
Source:
public static ConfigDef getConfig() { Map<String, ConfigDef.ConfigKey> everything = new HashMap<>(CONFIG_DEF.configKeys()); everything.putAll(StorageCommonConfig.getConfig().configKeys()); everything.putAll(PartitionerConfig.getConfig().configKeys()); Set<String> skip = new HashSet<>(); skip.add(StorageSinkConnectorConfig.ROTATE_SCHEDULE_INTERVAL_MS_CONFIG); skip.add(StorageSinkConnectorConfig.SHUTDOWN_TIMEOUT_CONFIG); ConfigDef visible = new ConfigDef(); visible.define( STORAGE_CLASS_CONFIG, Type.CLASS, Importance.HIGH, STORAGE_CLASS_DOC, "Storage", 1, Width.NONE, STORAGE_CLASS_DISPLAY ); visible.define( FORMAT_CLASS_CONFIG, Type.CLASS, Importance.HIGH, FORMAT_CLASS_DOC, "Connector", 1, Width.NONE, FORMAT_CLASS_DISPLAY ); for (ConfigDef.ConfigKey key : everything.values()) { if(!skip.contains(key.name)) { visible.define(key); } } return visible; }

Target:
public static ConfigDef getConfig() { Map<String, ConfigDef.ConfigKey> everything = new HashMap<>(CONFIG_DEF.configKeys()); everything.putAll(StorageCommonConfig.getConfig().configKeys()); everything.putAll(PartitionerConfig.getConfig().configKeys()); Set<String> skip = new HashSet<>(); skip.add(STORAGE_CLASS_CONFIG); skip.add(FORMAT_CLASS_CONFIG); ConfigDef visible = new ConfigDef(); visible.define( STORAGE_CLASS_CONFIG, Type.CLASS, HdfsStorage.class.getName(), Importance.HIGH, STORAGE_CLASS_DOC, "Storage", 1, Width.NONE, STORAGE_CLASS_DISPLAY ); visible.define( FORMAT_CLASS_CONFIG, Type.CLASS, AvroFormat.class.getName(), Importance.HIGH, FORMAT_CLASS_DOC, "Connector", 1, Width.NONE, FORMAT_CLASS_DISPLAY ); for (ConfigDef.ConfigKey key : everything.values()) { if (!skip.contains(key.name)) { visible.define(key); } } return visible; }
Source:
private String getDefaultEmulatedMachineLabel() { DataCenterWithCluster dataCenterWithCluster = getModel().getDataCenterWithClustersList().getSelectedItem(); String newClusterEmulatedMachine; if (dataCenterWithCluster == null) { newClusterEmulatedMachine = ""; } else { newClusterEmulatedMachine = (dataCenterWithCluster.getCluster().getEmulatedMachine() == null) ? "" : dataCenterWithCluster.getCluster().getEmulatedMachine(); } newClusterEmulatedMachine = constants.clusterDefaultOption() + "(" + newClusterEmulatedMachine + ")"; return newClusterEmulatedMachine; }

Target:
private String getDefaultEmulatedMachineLabel() { VDSGroup vdsGroup = getModel().getSelectedCluster(); String newClusterEmulatedMachine = constants.clusterDefaultOption(); if (vdsGroup != null) { String emulatedMachine = (vdsGroup.getEmulatedMachine() == null) ? "" : vdsGroup.getEmulatedMachine(); newClusterEmulatedMachine += "(" + emulatedMachine + ")"; } return newClusterEmulatedMachine; }
Source:
public void sharedMemorySetTest() { assertEquals("Shared memory is not set", redisWithSharedMemory.getShmSize(), 1024 * FileUtils.ONE_MB); HostConfig hostConfig = redisWithSharedMemory.getDockerClient().inspectContainerCmd(redisWithSharedMemory.getContainerId()) .exec().getHostConfig(); assertEquals("Shared memory not set on container", hostConfig.getShmSize(), 1024 * FileUtils.ONE_MB); }

Target:
public void sharedMemorySetTest() { try (GenericContainer containerWithSharedMemory = new GenericContainer("busybox:1.29") .withSharedMemorySize(1024L * FileUtils.ONE_MB)) { containerWithSharedMemory.start(); HostConfig hostConfig = containerWithSharedMemory.getDockerClient().inspectContainerCmd(containerWithSharedMemory.getContainerId()) .exec().getHostConfig(); assertEquals("Shared memory not set on container", hostConfig.getShmSize(), 1024 * FileUtils.ONE_MB); } }
Source:
protected VDSReturnValue executeVerb(StorageDomainStatic storage) { try { GetVmsInfoVDSCommandParameters tempVar = new GetVmsInfoVDSCommandParameters( getParameters().getStoragePoolId()); tempVar.setStorageDomainId(getParameters().getStorageDomainId()); tempVar.setVmIdList(getParameters().getIds()); return Backend.getInstance().getResourceManager() .RunVdsCommand(VDSCommandType.GetVmsInfo, tempVar); } catch (RuntimeException e) { AuditLogableBase logable = new AuditLogableBase(); logable.addCustomValue("StorageDomainName", storage.getStorageName()); AuditLogDirector.log(logable, AuditLogType.IMPORTEXPORT_GET_VMS_INFO_FAILED); throw e; } }

Target:
private VDSReturnValue executeVerb(StorageDomainStatic storage) { try { return Backend.getInstance().getResourceManager() .RunVdsCommand(VDSCommandType.GetVmsInfo, buildGetVmsInfoParameters(storage)); } catch (RuntimeException e) { AuditLogableBase logable = new AuditLogableBase(); logable.addCustomValue("StorageDomainName", storage.getStorageName()); AuditLogDirector.log(logable, AuditLogType.IMPORTEXPORT_GET_VMS_INFO_FAILED); throw e; } }
Source:
private static ZipDumpReader create( final SystemLoadListener listener, final String dumpName, final ZipFile zipFile ) { if ( zipFile.getEntry( "dump.json" ) != null ) { return new ZipDumpReader( listener, PathRef.of(), zipFile ); } else if ( zipFile.getEntry( dumpName + "/dump.json" ) != null ) { return new ZipDumpReader( listener, PathRef.of( dumpName ), zipFile ); } else { String rootDumpDir = null; final Enumeration<ZipArchiveEntry> entries = zipFile.getEntries(); while ( entries.hasMoreElements() ) { final ZipArchiveEntry entry = entries.nextElement(); final Matcher matcher = ROOT_DUMP_DIR_PATTERN.matcher( entry.getName() ); if ( matcher.find() ) { rootDumpDir = matcher.group( 1 ); break; } } if ( rootDumpDir != null ) { return new ZipDumpReader( listener, PathRef.of( rootDumpDir ), zipFile ); } else { throw new RepoLoadException( "Archive is not a valid dump archive: [" + dumpName + "]" ); } } }

Target:
private static ZipDumpReader create( final SystemLoadListener listener, final String dumpName, final ZipFile zipFile ) { if ( zipFile.getEntry( "dump.json" ) != null ) { return new ZipDumpReader( listener, PathRef.of(), zipFile ); } else if ( zipFile.getEntry( dumpName + "/dump.json" ) != null ) { return new ZipDumpReader( listener, PathRef.of( dumpName ), zipFile ); } else { final Enumeration<ZipArchiveEntry> entries = zipFile.getEntries(); while ( entries.hasMoreElements() ) { final ZipArchiveEntry entry = entries.nextElement(); final Matcher matcher = ROOT_DUMP_DIR_PATTERN.matcher( entry.getName() ); if ( matcher.matches() ) { return new ZipDumpReader( listener, PathRef.of( matcher.group( 1 ) ), zipFile ); } } throw new RepoLoadException( "Archive is not a valid dump archive: [" + dumpName + "]" ); } }
Source:
protected void stopPartitionReplication(PartitionId partitionId) throws ReplicationException { PartitionInfo partitionInfo = partitionToPartitionInfo.remove(partitionId); if (partitionInfo == null) { logger.warn("Partition not exist when remove from {}. ", partitionId, dataNodeId); return; } removeRemoteReplicaInfoFromReplicaThread(partitionInfo.getRemoteReplicaInfos()); if (replicationConfig.replicationPersistTokenOnShutdownOrReplicaRemove) { try { persistor.write(partitionInfo.getLocalReplicaId().getMountPath(), false); } catch (IOException | ReplicationException e) { throw new ReplicationException( "Exception on token write when removing Partition " + partitionId + " from: " + dataNodeId); } } }

Target:
protected void stopPartitionReplication(PartitionId partitionId) { PartitionInfo partitionInfo = partitionToPartitionInfo.remove(partitionId); if (partitionInfo == null) { logger.warn("Partition not exist when remove from {}. ", partitionId, dataNodeId); return; } removeRemoteReplicaInfoFromReplicaThread(partitionInfo.getRemoteReplicaInfos()); if (replicationConfig.replicationPersistTokenOnShutdownOrReplicaRemove) { try { persistor.write(partitionInfo.getLocalReplicaId().getMountPath(), false); } catch (IOException | ReplicationException e) { logger.error( "Exception " + e + " on token write when removing Partition " + partitionId + " from: " + dataNodeId); } } }
Source:
public List<String> getBarcodes() { final String barcodeString = getAttribute(BARCODE_TAG); if(barcodeString == null){ return null; } else if( barcodeString.isEmpty()){ return Collections.emptyList(); } else { return Arrays.asList( barcodeString.split(BARCODE_SEPARATOR)); } }

Target:
public List<String> getBarcodes() { final String barcodeString = getAttribute(BARCODE_TAG); if (barcodeString == null) { return null; } else if (barcodeString.isEmpty()) { return Collections.emptyList(); } else { return Arrays.asList(barcodeString.split(SamConstants.BARCODE_SEQUENCE_DELIMITER)); } }
Source:
public static CoordinatesCalculateDialog getInstance(final Geopoint gp, final CalcState calculationState) { final Bundle args = new Bundle(); if (gp != null) { args.putParcelable(GEOPOINT_ARG, gp); } final CoordinatesCalculateDialog cid = new CoordinatesCalculateDialog(); cid.setArguments(args); cid.setCalcState(calculationState); return cid; }

Target:
public static CoordinatesCalculateDialog getInstance(final Geopoint gp, final CalcState calculationState) { final Bundle args = new Bundle(); if (gp != null) { args.putParcelable(GEOPOINT_ARG, gp); } final CoordinatesCalculateDialog ccd = new CoordinatesCalculateDialog(); ccd.setArguments(args); ccd.setSavedState(calculationState); return ccd; }
Source:
private StructuredRecord createStructuredRecord(CSVRecord record) { StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); int i = 0; for (Field field : fields) { String val = record.get(i); Schema fieldSchema = field.getSchema(); if (val.isEmpty()) { boolean isNullable = fieldSchema.isNullable(); Schema.Type fieldType = isNullable ? fieldSchema.getNonNullable().getType() : fieldSchema.getType(); if (fieldType == Schema.Type.STRING) { builder.set(field.getName(), ""); } else if (!isNullable) { throw new IllegalArgumentException(String.format( "The %dth field named '%s' is of non-nullable type '%s', " + "but was parsed as an empty string for CSV record '%s'", i + 1, field.getName(), field.getSchema().getType(), record)); } } else { builder.convertAndSet(field.getName(), val); } ++i; } return builder.build(); }

Target:
private StructuredRecord createStructuredRecord(CSVRecord record) { StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); int i = 0; for (Field field : fields) { String val = record.get(i); Schema fieldSchema = field.getSchema(); if (val.isEmpty()) { boolean isNullable = fieldSchema.isNullable(); Schema.Type fieldType = isNullable ? fieldSchema.getNonNullable().getType() : fieldSchema.getType(); if (fieldType == Schema.Type.STRING) { builder.set(field.getName(), ""); } else if (!isNullable) { throw new IllegalArgumentException(String.format( "Field #%d (named '%s') is of non-nullable type '%s', " + "but was parsed as an empty string for CSV record '%s'", i, field.getName(), field.getSchema().getType(), record)); } } else { builder.convertAndSet(field.getName(), val); } ++i; } return builder.build(); }
Source:
public void setParamsToEntity(Map<VirtualMachineProfile.Param, Object> map) { if (this.vmEntityVO != null) { Map<String, String> details = this.vmEntityVO.getDetails(); if (details == null) { details = new HashMap<String, String>(); } if (map != null && !map.isEmpty()) { for (Map.Entry<VirtualMachineProfile.Param, Object> entry : map.entrySet()) { if (null != entry && null != entry.getValue() && null != entry.getKey()) { details.put(entry.getKey().getName(), entry.getValue().toString()); } } this.vmEntityVO.setDetails(details); } } }

Target:
public void setParamsToEntity(Map<VirtualMachineProfile.Param, Object> map) { if (MapUtils.isNotEmpty(map)) { if (this.vmEntityVO != null) { Map<String, String> details = this.vmEntityVO.getDetails(); if (details == null) { details = new HashMap<String, String>(); } for (Map.Entry<VirtualMachineProfile.Param, Object> entry : map.entrySet()) { if (null != entry && null != entry.getValue() && null != entry.getKey()) { details.put(entry.getKey().getName(), entry.getValue().toString()); } } this.vmEntityVO.setDetails(details); } } }
Source:
public boolean accept(InputFile inputFile) { if (!Php.KEY.equals(inputFile.language())) { return true; } String relativePath = inputFile.uri().toString(); if (WildcardPattern.match(WildcardPattern.create(excludedPatterns), relativePath)) { LOG.debug("File [" + inputFile.uri() + "] is excluded by '" + PhpPlugin.PHP_EXCLUSIONS_KEY + "' property and will not be analyzed"); return false; } if (new AverageLineLengthCalculator(inputFile).getAverageLineLength() > DEFAULT_AVERAGE_LINE_LENGTH_THRESHOLD) { LOG.debug("File [" + inputFile.uri() + "] is excluded because its default average line length is greater than " + DEFAULT_AVERAGE_LINE_LENGTH_THRESHOLD); return false; } return true; }

Target:
public boolean accept(InputFile inputFile) { if (!Php.KEY.equals(inputFile.language())) { return true; } String relativePath = inputFile.uri().toString(); if (WildcardPattern.match(WildcardPattern.create(excludedPatterns), relativePath)) { LOG.debug("File [" + inputFile.uri() + "] is excluded by '" + PhpPlugin.PHP_EXCLUSIONS_KEY + "' property and will not be analyzed"); return false; } if (new AverageLineLengthCalculator(inputFile).getAverageLineLength() > DEFAULT_AVERAGE_LINE_LENGTH_THRESHOLD) { LOG.debug("File [" + inputFile.uri() + "] is excluded because it is considered generated (average line length is too big)."); return false; } return true; }
Source:
public void refresh(HelixDataAccessor accessor) { long startTime = System.currentTimeMillis(); PropertyKey.Builder keyBuilder = accessor.keyBuilder(); Set<PropertyKey> currentIdealStateKeys = new HashSet<>(); for (String idealState : accessor.getChildNames(keyBuilder.idealStates())) { currentIdealStateKeys.add(keyBuilder.idealStates(idealState)); } Set<PropertyKey> cachedKeys = new HashSet<>(); Map<PropertyKey, IdealState> cachedIdealStateMap = Maps.newHashMap(); for (String idealState : _idealStateCache.keySet()) { cachedKeys.add(keyBuilder.idealStates(idealState)); cachedIdealStateMap .put(keyBuilder.idealStates(idealState), _idealStateCache.get(idealState)); } cachedKeys.retainAll(currentIdealStateKeys); Set<PropertyKey> reloadKeys = new HashSet<>(currentIdealStateKeys); reloadKeys.removeAll(cachedKeys); Map<PropertyKey, IdealState> updatedMap = refreshProperties(accessor, reloadKeys, new ArrayList<>(cachedKeys), cachedIdealStateMap, reloadKeys); Map<String, IdealState> newIdealStateMap = Maps.newHashMap(); for (IdealState idealState : updatedMap.values()) { newIdealStateMap.put(idealState.getResourceName(), idealState); } _idealStateCache = new HashMap<>(newIdealStateMap); _idealStateMap = new HashMap<>(newIdealStateMap); long endTime = System.currentTimeMillis(); LogUtil.logInfo(LOG, _controlContextProvider.getClusterEventId(), "Refresh " + _idealStateMap.size() + " idealStates for cluster " + _clusterName + ", took " + (endTime - startTime) + " ms"); }

Target:
public void refresh(HelixDataAccessor accessor) { long startTime = System.currentTimeMillis(); PropertyKey.Builder keyBuilder = accessor.keyBuilder(); Set<PropertyKey> currentIdealStateKeys = new HashSet<>(); for (String idealState : accessor.getChildNames(keyBuilder.idealStates())) { currentIdealStateKeys.add(keyBuilder.idealStates(idealState)); } Set<PropertyKey> cachedKeys = new HashSet<>(); Map<PropertyKey, IdealState> cachedIdealStateMap = Maps.newHashMap(); for (String idealState : _idealStateCache.keySet()) { cachedKeys.add(keyBuilder.idealStates(idealState)); cachedIdealStateMap .put(keyBuilder.idealStates(idealState), _idealStateCache.get(idealState)); } cachedKeys.retainAll(currentIdealStateKeys); Set<PropertyKey> reloadKeys = new HashSet<>(currentIdealStateKeys); reloadKeys.removeAll(cachedKeys); Map<PropertyKey, IdealState> updatedMap = refreshProperties(accessor, reloadKeys, new ArrayList<>(cachedKeys), cachedIdealStateMap, new HashSet<>()); Map<String, IdealState> newIdealStateMap = Maps.newHashMap(); for (IdealState idealState : updatedMap.values()) { newIdealStateMap.put(idealState.getResourceName(), idealState); } _idealStateCache = new HashMap<>(newIdealStateMap); _idealStateMap = new HashMap<>(newIdealStateMap); long endTime = System.currentTimeMillis(); LogUtil.logInfo(LOG, _controlContextProvider.getClusterEventId(), "Refresh " + _idealStateMap.size() + " idealStates for cluster " + _clusterName + ", took " + (endTime - startTime) + " ms"); }
Source:
protected boolean requestRequiresAuthentication(final HttpServletRequest request, final HttpServletResponse response) { val accessTokenRequest = isAccessTokenRequest(request, response); val revokeTokenRequest = isRevokeTokenRequest(request, response); if (revokeTokenRequest) { return clientNeedAuthentication(request, response); } if (!accessTokenRequest) { val extractor = extractAccessTokenGrantRequest(request); if (extractor.isPresent()) { val ext = extractor.get(); return ext.requestMustBeAuthenticated(); } } else { val extractor = extractAccessTokenGrantRequest(request); if (extractor.isPresent()) { val ext = extractor.get(); return ext.getResponseType() != OAuth20ResponseTypes.DEVICE_CODE; } } return false; }

Target:
protected boolean requestRequiresAuthentication(final HttpServletRequest request, final HttpServletResponse response) { val revokeTokenRequest = isRevokeTokenRequest(request, response); if (revokeTokenRequest) { return clientNeedAuthentication(request, response); } val accessTokenRequest = isAccessTokenRequest(request, response); if (!accessTokenRequest) { val extractor = extractAccessTokenGrantRequest(request); if (extractor.isPresent()) { val ext = extractor.get(); return ext.requestMustBeAuthenticated(); } } else { val extractor = extractAccessTokenGrantRequest(request); if (extractor.isPresent()) { val ext = extractor.get(); return ext.getResponseType() != OAuth20ResponseTypes.DEVICE_CODE; } } return false; }
Source:
public StoredConfig getUserConfig() throws IOException, ConfigInvalidException { FileBasedConfig c = openUserConfig(getSystemConfig(), FS.DETECTED); if (c.isOutdated()) { LOG.debug("loading user config {}", userConfig); c.load(); } return c; }

Target:
public StoredConfig getUserConfig() throws IOException, ConfigInvalidException { FileBasedConfig c = userConfig.get(); if (c == null) { userConfig.compareAndSet(null, openUserConfig(getSystemConfig(), FS.DETECTED)); c = userConfig.get(); } else { getSystemConfig(); } if (c.isOutdated()) { LOG.debug("loading user config {}", userConfig); c.load(); } return c; }
Source:
private BitmapDescriptor getClusterIcon(Cluster<Person> cluster) { List<Drawable> profilePhotos; profilePhotos = new ArrayList<Drawable>(Math.min(4, cluster.getSize())); int width = mDimension; int height = mDimension; for (Person p : cluster.getItems()) { if (profilePhotos.size() == 4) break; Drawable drawable = getResources().getDrawable(p.profilePhoto); drawable.setBounds(0, 0, width, height); profilePhotos.add(drawable); } MultiDrawable multiDrawable = new MultiDrawable(profilePhotos); multiDrawable.setBounds(0, 0, width, height); mClusterImageView.setImageDrawable(multiDrawable); Bitmap icon = mClusterIconGenerator.makeIcon(String.valueOf(cluster.getSize())); return BitmapDescriptorFactory.fromBitmap(icon); }

Target:
private BitmapDescriptor getClusterIcon(Cluster<Person> cluster) { List<Drawable> profilePhotos = new ArrayList<>(Math.min(4, cluster.getSize())); int width = mDimension; int height = mDimension; for (Person p : cluster.getItems()) { if (profilePhotos.size() == 4) break; Drawable drawable = getResources().getDrawable(p.profilePhoto); drawable.setBounds(0, 0, width, height); profilePhotos.add(drawable); } MultiDrawable multiDrawable = new MultiDrawable(profilePhotos); multiDrawable.setBounds(0, 0, width, height); mClusterImageView.setImageDrawable(multiDrawable); Bitmap icon = mClusterIconGenerator.makeIcon(String.valueOf(cluster.getSize())); return BitmapDescriptorFactory.fromBitmap(icon); }
Source:
private void checkCompletedSubgoals(State state) { int len = this.recipeSubgoals.size(); for (int i = 0; i < len; i++) { if (this.recipeSubgoals.get(i).goalCompleted(state)) { this.completedSubgoals[i] = true; } } }

Target:
private void checkCompletedSubgoals(State state) { int len = this.recipeSubgoals.size(); for (int i = 0; i < len; i++) { this.completedSubgoals[i] |= this.recipeSubgoals.get(i).goalCompleted(state); } }
Source:
private void logErrorFully(Response.Status status, Throwable throwable) { if (LOG.isDebugEnabled()) { LOG.debug("Failed with " + status, throwable); } }

Target:
private void logErrorFully(Response.Status status, Throwable throwable) { LOG.debug("Failed with {}", status, throwable); }
Source:
public static KubernetesClientConfig create(final Optional<String> name, final Config systemConfig, final Config requestConfig) { Config config; if (requestConfig.get("agent.command_executor.type", String.class, "").equals("kubernetes")) { config = requestConfig; } else { config = systemConfig; } return KubernetesClientConfig.create(name, config); }

Target:
public static KubernetesClientConfig create(final Optional<String> name, final Config systemConfig, final Config requestConfig) { String clusterName = null; if (name.isPresent()) { clusterName = name.get(); } Config extractedSystemConfig = null; if (systemConfig != null && systemConfig.get("agent.command_executor.type", String.class, "").equals("kubernetes")) { if (clusterName == null) { clusterName = systemConfig.get(KUBERNETES_CLIENT_PARAMS_PREFIX + "name", String.class); } final String keyPrefix = KUBERNETES_CLIENT_PARAMS_PREFIX + clusterName + "."; extractedSystemConfig = StorageManager.extractKeyPrefix(systemConfig, keyPrefix); } Config extractedRequestConfig = null; if (requestConfig != null && requestConfig.has("kubernetes")) { if (clusterName == null) { clusterName = requestConfig.get("name", String.class); } extractedRequestConfig = requestConfig.getNested("kubernetes"); } final Config config; if (extractedSystemConfig != null && extractedRequestConfig != null) { config = extractedSystemConfig.merge(extractedRequestConfig); } else if (extractedRequestConfig != null) { config = extractedRequestConfig; } else if (extractedSystemConfig != null) { config = extractedSystemConfig; } else { throw new ConfigException("systemConfig and requestConfig does not exist"); } return KubernetesClientConfig.createKubeConfig(clusterName, config); }
Source:
public Set<TSnePoint> fetchTSnePlotWithExpression(String experimentAccession, int perplexity, String geneId) { return tSnePlotServiceDao.fetchTSnePlotWithExpression(experimentAccession, perplexity, geneId).stream() .map( pointDto -> TSnePoint.create( Math.round(pointDto.x()*100.0)/100.0 ,Math.round(pointDto.y()*100.0)/100.0, pointDto.expressionLevel(), pointDto.name())) .collect(toSet()); }

Target:
public Set<TSnePoint> fetchTSnePlotWithExpression(String experimentAccession, int perplexity, String geneId) { return tSnePlotServiceDao.fetchTSnePlotWithExpression(experimentAccession, perplexity, geneId).stream() .map( pointDto -> TSnePoint.create( MathUtils.round(pointDto.x(), 2), MathUtils.round(pointDto.y(), 2), pointDto.expressionLevel(), pointDto.name())) .collect(toSet()); }
Source:
public void leaderCanProcessMultiClientGetCommitTimestampRequest() { MultiClientConjureTimelockService service = cluster.currentLeaderFor(client.namespace()).multiClientService(); Set<String> expectedNamespaces = ImmutableSet.of("alpha", "beta"); List<NamespacedGetCommitTimestampsResponse> commitTimestamps = service.getCommitTimestamps(AUTH_HEADER, getGetCommitTimestampsRequests(expectedNamespaces)); Set<String> namespaces = commitTimestamps.stream() .map(NamespacedGetCommitTimestampsResponse::getNamespace) .collect(Collectors.toSet()); assertThat(namespaces).hasSameElementsAs(expectedNamespaces); }

Target:
public void leaderCanProcessMultiClientGetCommitTimestampRequest() { MultiClientConjureTimelockService service = cluster.currentLeaderFor(client.namespace()).multiClientService(); Set<String> expectedNamespaces = ImmutableSet.of("alpha", "beta"); List<NamespacedGetCommitTimestampsResponse> commitTimestamps = service.getCommitTimestamps( AUTH_HEADER, defaultNamespacedGetCommitTimestampsRequests(expectedNamespaces)); Set<String> namespaces = commitTimestamps.stream() .map(NamespacedGetCommitTimestampsResponse::getNamespace) .collect(Collectors.toSet()); assertThat(namespaces).hasSameElementsAs(expectedNamespaces); Set<UUID> leadershipIds = commitTimestamps.stream() .map(NamespacedGetCommitTimestampsResponse::getLockWatchUpdate) .map(LockWatchStateUpdate::logId) .collect(Collectors.toSet()); assertThat(leadershipIds).hasSameSizeAs(expectedNamespaces); }
Source:
public String[] getConflictingIds(TaskEditorInput input) { List<String> conflictingIds = Lists.newArrayList(); conflictingIds.add(ITasksUiConstants.ID_PAGE_PLANNING); @SuppressWarnings("restriction") String artifactFlag = input.getTask().getAttribute(ITasksCoreConstants.ATTRIBUTE_ARTIFACT); if (artifactFlag != null && artifactFlag.equals("true")) { final String CONTEXT_PAGE = "org.eclipse.mylyn.context.ui"; conflictingIds.add(CONTEXT_PAGE); } return (String[]) conflictingIds.toArray(); }

Target:
public String[] getConflictingIds(TaskEditorInput input) { List<String> conflictingIds = ImmutableList.of(ITasksUiConstants.ID_PAGE_PLANNING); @SuppressWarnings("restriction") String artifactFlag = input.getTask().getAttribute(ITasksCoreConstants.ATTRIBUTE_ARTIFACT); if (Boolean.parseBoolean(artifactFlag)) { final String CONTEXT_PAGE = "org.eclipse.mylyn.context.ui"; conflictingIds.add(CONTEXT_PAGE); } return conflictingIds.toArray(new String[conflictingIds.size()]); }
Source:
ElasticsearchSearchResult<H> loadBlocking() { SearchProjectionTransformContext transformContext = extractContext.createProjectionTransformContext(); LoadingResult<?> loadingResult = extractContext.getProjectionHitMapper().loadBlocking( null ); int readIndex = 0; int writeIndex = 0; for ( ; readIndex < extractedHits.size(); ++readIndex ) { transformContext.reset(); H transformed = transformUnsafe( rootProjection, loadingResult, extractedHits.get( readIndex ), transformContext ); if ( transformContext.hasFailedLoad() ) { continue; } extractedHits.set( writeIndex, transformed ); ++writeIndex; } if ( writeIndex < readIndex ) { extractedHits.subList( writeIndex, readIndex ).clear(); } @SuppressWarnings("unchecked") List<H> loadedHits = Collections.unmodifiableList( (List<? extends H>) extractedHits ); extractedHits = null; return new ElasticsearchSearchResultImpl<>( extractContext.getResponseBody(), hitCount, loadedHits, extractedAggregations , took, timedOut ); }

Target:
ElasticsearchSearchResult<H> loadBlocking() { SearchProjectionTransformContext transformContext = extractContext.createProjectionTransformContext(); LoadingResult<?> loadingResult = extractContext.getProjectionHitMapper().loadBlocking(); int readIndex = 0; int writeIndex = 0; for ( ; readIndex < extractedHits.size(); ++readIndex ) { transformContext.reset(); H transformed = transformUnsafe( rootProjection, loadingResult, extractedHits.get( readIndex ), transformContext ); if ( transformContext.hasFailedLoad() ) { continue; } extractedHits.set( writeIndex, transformed ); ++writeIndex; } if ( writeIndex < readIndex ) { extractedHits.subList( writeIndex, readIndex ).clear(); } @SuppressWarnings("unchecked") List<H> loadedHits = Collections.unmodifiableList( (List<? extends H>) extractedHits ); extractedHits = null; return new ElasticsearchSearchResultImpl<>( extractContext.getResponseBody(), hitCount, loadedHits, extractedAggregations , took, timedOut ); }
Source:
public String getAccessibility() { return accessibility; }

Target:
public ETextAccessibility getAccessibility() { return accessibility; }
Source:
public Object stSphericalArea(BenchmarkData data) { return GeoFunctions.stSphericalArea(data.geometry); }

Target:
public Object stSphericalArea(BenchmarkData data) { return GeoFunctions.stSphericalArea(data.geography); }
Source:
private String parseSentenceClose() throws ParseException { int index = nextNonBlank(); if (index < 0 || expression.charAt(index) != ';') { throw new ParseException(errorMessage(SENTENCE_NOT_CLOSED_PROPERLY_ERROR), parseIndex); } parseIndex = index + 1; while (parseIndex < expression.length()) { if (!isBlank(expression.charAt(parseIndex))) { throw new ParseException(errorMessage(SENTENCE_NOT_CLOSED_PROPERLY_ERROR), parseIndex); } parseIndex++; } return ";"; }

Target:
private void parseSentenceClose() throws ParseException { int index = nextNonBlank(); if (index < 0 || expression.charAt(index) != ';') { throw new ParseException(errorMessage(SENTENCE_NOT_CLOSED_PROPERLY_ERROR), parseIndex); } parseIndex = index + 1; while (parseIndex < expression.length()) { if (isNoneBlank(expression.charAt(parseIndex))) { throw new ParseException(errorMessage(SENTENCE_NOT_CLOSED_PROPERLY_ERROR), parseIndex); } parseIndex++; } }
Source:
public static String getArgValue(String[] args, String key) { int pos = ArrayUtils.indexOf(args, "-" + key); if (pos < 0 || pos >= args.length) { return null; } if (pos == args.length - 1 || args[pos + 1] == null || args[pos + 1].startsWith("-")) { return StringConstants.EMPTY; } return args[pos + 1]; }

Target:
public static String getArgValue(String[] args, String key) { int pos = ArrayUtils.indexOf(args, StringConstants.MINUS + key); if (pos < 0 || pos >= args.length) { return null; } if (pos == args.length - 1 || args[pos + 1] == null || args[pos + 1].startsWith(StringConstants.MINUS)) { return StringConstants.EMPTY; } return args[pos + 1]; }
Source:
public void createStatus() throws IOException { RepositoryId repo = new RepositoryId("o", "n"); CommitStatus status = new CommitStatus(); status.setDescription("description"); status.setTargetUrl("http://target/url"); status.setState(CommitStatus.STATE_SUCCESS); status.getContext("context"); service.createStatus(repo, "123", status); Map<String, String> params = new HashMap<String, String>(); params.put("description", status.getDescription()); params.put("target_url", status.getTargetUrl()); params.put("state", status.getState()); params.put("context", status.getContext()); verify(client).post("/repos/o/n/statuses/123", params, CommitStatus.class); }

Target:
public void createStatus() throws IOException { RepositoryId repo = new RepositoryId("o", "n"); CommitStatus status = new CommitStatus(); status.setDescription("description"); status.setTargetUrl("http://target/url"); status.setState(CommitStatus.STATE_SUCCESS); status.setContext("context"); service.createStatus(repo, "123", status); Map<String, String> params = new HashMap<String, String>(); params.put("description", status.getDescription()); params.put("target_url", status.getTargetUrl()); params.put("state", status.getState()); params.put("context", status.getContext()); verify(client).post("/repos/o/n/statuses/123", params, CommitStatus.class); }
Source:
public static void main(String[] args) throws IOException { Options options = new Options(); options.addOption(Option.builder("d") .longOpt("dest") .desc("Set destination directory for .class files") .hasArg() .argName("dir") .build()); options.addOption(Option.builder("v") .longOpt("verbose") .desc("Make the compiler more noisy") .build() ); options.addOption(Option.builder("h") .longOpt("help") .desc("Show this help information.") .build() ); CommandLineParser cliparser = new DefaultParser(); CommandLine line; try { line = cliparser.parse(options, args); } catch (ParseException exp) { System.err.println(exp.getMessage()); printHelp(options); return; } if (line.hasOption('h')) { printHelp(options); return; } String outDir = line.getOptionValue('d', "target" + File.separator + "classes"); if (!outDir.endsWith(File.separator)) { outDir += File.separator; } verbose = line.hasOption('v'); ArrayList<ProgramNode> trees = new ArrayList<>(); ProgramNode prelude = generateIRTree(App.class.getResourceAsStream("Prelude.bla"), "Babble\\Prelude.bla"); trees.add(prelude); for (String inPath : line.getArgs()) { File file = new File(inPath); ProgramNode babbleFile = generateIRTree(new FileInputStream(file), file.getPath()); trees.add(babbleFile); } compileTrees(outDir, trees.toArray(new ProgramNode[0])); if (verbose) { System.out.println("[ OK ] Compiled."); } }

Target:
public static void main(String[] args) throws IOException { Options options = new Options(); options.addOption(Option.builder("d") .longOpt("dest") .desc("Set destination directory for .class files") .hasArg() .argName("dir") .build()); options.addOption(Option.builder("v") .longOpt("verbose") .desc("Make the compiler more noisy") .build() ); options.addOption(Option.builder("h") .longOpt("help") .desc("Show this help information.") .build() ); CommandLineParser cliparser = new DefaultParser(); CommandLine line; try { line = cliparser.parse(options, args); } catch (ParseException exp) { System.err.println(exp.getMessage()); printHelp(options); return; } if (line.hasOption('h')) { printHelp(options); return; } String outDir = line.getOptionValue('d', "target" + File.separator + "classes"); if (!outDir.endsWith(File.separator)) { outDir += File.separator; } verbose = line.hasOption('v'); ArrayList<ProgramNode> trees = new ArrayList<>(); ProgramNode prelude = generateIRTree(App.class.getResourceAsStream("Prelude.bla"), "Babble\\Prelude.bla"); trees.add(prelude); for (String inPath : line.getArgs()) { File file = new File(inPath); ProgramNode babbleFile = generateIRTree(new FileInputStream(file), file.getPath()); trees.add(babbleFile); } List<String> errors = compileTrees(outDir, trees); if (errors.isEmpty()) { if (verbose) { System.out.println("[ OK ] Compiled."); } } else { System.out.println(String.format("[ ERROR ] %d Errors while compiling.", errors.size())); throw new CompileException(); } }
Source:
public void onDisable() { if (instance == null || minecraftVersion == MinecraftVersion.UNIT_TEST) { return; } Bukkit.getScheduler().cancelTasks(this); if (ticker != null) { ticker.halt(); ticker.run(); } PlayerProfile.iterator().forEachRemaining(profile -> { if (profile.isDirty()) { profile.save(); } }); getRegistry().getWorlds().forEach((world, storage) -> { try { storage.save(true); } catch (Exception x) { getLogger().log(Level.SEVERE, x, () -> "An Error occurred while saving Slimefun-Blocks in World '" + world + "' for Slimefun " + getVersion()); } }); for (UniversalBlockMenu menu : registry.getUniversalInventories().values()) { menu.save(); } backupService.run(); AContainer.processing = null; AContainer.progress = null; AGenerator.processing = null; AGenerator.progress = null; Reactor.processing = null; Reactor.progress = null; instance = null; for (Player p : Bukkit.getOnlinePlayers()) { p.closeInventory(); } }

Target:
public void onDisable() { if (instance == null || minecraftVersion == MinecraftVersion.UNIT_TEST) { return; } Bukkit.getScheduler().cancelTasks(this); if (ticker != null) { ticker.halt(); ticker.run(); } PlayerProfile.iterator().forEachRemaining(profile -> { if (profile.isDirty()) { profile.save(); } }); for (Map.Entry<String, BlockStorage> entry : getRegistry().getWorlds().entrySet()) { try { entry.getValue().save(true); } catch (Exception x) { getLogger().log(Level.SEVERE, x, () -> "An Error occurred while saving Slimefun-Blocks in World '" + entry.getKey() + "' for Slimefun " + getVersion()); } } for (UniversalBlockMenu menu : registry.getUniversalInventories().values()) { menu.save(); } backupService.run(); AContainer.processing = null; AContainer.progress = null; AGenerator.processing = null; AGenerator.progress = null; Reactor.processing = null; Reactor.progress = null; instance = null; for (Player p : Bukkit.getOnlinePlayers()) { p.closeInventory(); } }