auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Vector2f scaleForRegion(Rect2i region, int actualWidth, int actualHeight) { if(actualHeight < 500) { System.out.println("Hell of a job"); float scale = Math.max((float) region.width() / actualWidth, (float) region.height() / actualHeight); return new Vector2f(actualWidth * scale, actualHeight * scale); } System.out.println(actualHeight); float scale = Math.max((float) region.width() / actualWidth, (float) region.height() / actualHeight); return new Vector2f(actualWidth * scale, (actualHeight * scale)-100); }

Target:
public Vector2f scaleForRegion(Rect2i region, int actualWidth, int actualHeight) { return new Vector2f(region.width(), region.height()); }
Source:
private void loadCheckpoint(Map<String, Object> checkpoint) { if (checkpoint == null || checkpoint.isEmpty()) { LOG.warn("No checkpoints supplied. Skipping checkpoint load"); return; } String err = String.format("Load checkpoint called with %s keys when expected %s. Checkpoint supplied %s", checkpoint.size(), _chunkingKeys.size(), checkpoint); Validate.isTrue(checkpoint.size() == _chunkingKeys.size(), err); _chunkingKeys.keySet().forEach(k -> { Validate.isTrue(checkpoint.containsKey(k), String.format("Load checkpoint called without key %s. Checkpoint map supplied : %s", k, checkpoint)); _chunkingKeys.put(k, checkpoint.get(k)); }); }

Target:
private void loadCheckpoint(Map<String, Object> checkpoint) { if (checkpoint == null || checkpoint.isEmpty()) { LOG.warn("No checkpoints supplied. Skipping checkpoint load"); return; } Validate.isTrue(checkpoint.size() == _chunkingKeys.size(), String.format("Load checkpoint called with %s keys when expected %s. Checkpoint supplied %s", checkpoint.size(), _chunkingKeys.size(), checkpoint)); _chunkingKeys.keySet().forEach(k -> { Validate.isTrue(checkpoint.containsKey(k), String.format("Load checkpoint called without key %s. Checkpoint map supplied : %s", k, checkpoint)); _chunkingKeys.put(k, checkpoint.get(k)); }); }
Source:
public static void main(String[] args) { Map<String, Object> opts = new Docopt(USAGE) .withVersion(GitRepositoryState.getRepositoryState().describe) .parse(args); AnsiConsole.systemInstall(); printStartupMsg(opts); configureLogger(opts); log.debug("Started with arguments: {}", opts); if (opts.get("--network-interface") != null) { opts.put("--address", getAddressFromInterfaceName((String) opts.get("--network-interface"))); opts.put("--bind-to-all-interfaces", false); } else if (opts.get("--address") == null) { opts.put("--bind-to-all-interfaces", true); opts.put("--address", "localhost"); } else { opts.put("--bind-to-all-interfaces", false); } log.info("Server arguments: {}", opts); createServiceDirectory(opts); if (Integer.parseInt((String) opts.get("--metadata-retention")) < 1) { throw new IllegalArgumentException("Max number of metadata files to retain must be greater than 0."); } Thread shutdownThread = new Thread(CorfuServer::cleanShutdown); shutdownThread.setName("ShutdownThread"); Runtime.getRuntime().addShutdownHook(shutdownThread); while (!shutdownServer) { final ServerContext serverContext = new ServerContext(opts); try { activeServer = new CorfuServerNode(serverContext); activeServer.startAndListen(); } catch (Throwable th) { log.error("CorfuServer: Server exiting due to unrecoverable error: ", th); System.exit(EXIT_ERROR_CODE); } if (cleanupServer) { clearDataFiles(serverContext); cleanupServer = false; } if (!shutdownServer) { log.info("main: Server restarting."); } } log.info("main: Server exiting due to shutdown"); }

Target:
public static void main(String[] args) { Map<String, Object> opts = new Docopt(USAGE) .withVersion(GitRepositoryState.getRepositoryState().describe) .parse(args); AnsiConsole.systemInstall(); printStartupMsg(opts); configureLogger(opts); if (opts.get("--network-interface") != null) { opts.put("--address", getAddressFromInterfaceName((String) opts.get("--network-interface"))); opts.put("--bind-to-all-interfaces", false); } else if (opts.get("--address") == null) { opts.put("--bind-to-all-interfaces", true); opts.put("--address", "localhost"); } else { opts.put("--bind-to-all-interfaces", false); } createServiceDirectory(opts); if (Integer.parseInt((String) opts.get("--metadata-retention")) < 1) { throw new IllegalArgumentException("Max number of metadata files to retain must be greater than 0."); } Thread shutdownThread = new Thread(CorfuServer::cleanShutdown); shutdownThread.setName("ShutdownThread"); Runtime.getRuntime().addShutdownHook(shutdownThread); while (!shutdownServer) { final ServerContext serverContext = new ServerContext(opts); try { activeServer = new CorfuServerNode(serverContext); log.info("Server arguments: {}", opts); activeServer.startAndListen(); } catch (Throwable th) { log.error("CorfuServer: Server exiting due to unrecoverable error: ", th); System.exit(EXIT_ERROR_CODE); } if (cleanupServer) { clearDataFiles(serverContext); cleanupServer = false; } if (!shutdownServer) { log.info("main: Server restarting."); } } log.info("main: Server exiting due to shutdown"); }
Source:
boolean isRequired() { BeanValidationContext config = BeanValidationConfiguration.get(); List<Class<? extends Annotation>> notNullAnnotations = config.getNotNullAnnotations(); Map<Annotation, ConstraintDescriptor<?>> constraints = findNotNullConstraints( notNullAnnotations); if (constraints.isEmpty()) { return false; } HashSet<Class<?>> validatorGroups = new HashSet<>(); validatorGroups.addAll(Arrays.asList(getGroups())); for (Annotation constraint : constraints.keySet()) { ConstraintDescriptor<?> constraintDescriptor = constraints.get(constraint); if (canApplyToDefaultGroup(constraintDescriptor) && validatorGroups.isEmpty()) { return true; } for (Class<?> constraintGroup : constraintDescriptor.getGroups()) { if (validatorGroups.contains(constraintGroup)) { return true; } } } return false; }

Target:
boolean isRequired() { List<ConstraintDescriptor<?>> constraints = findNotNullConstraints(NOT_NULL_ANNOTATIONS); if (constraints.isEmpty()) { return false; } Set<Class<?>> validatorGroups = new HashSet<>(); validatorGroups.addAll(Arrays.asList(getGroups())); for (ConstraintDescriptor<?> constraint : constraints) { if (canApplyToDefaultGroup(constraint) && validatorGroups.isEmpty()) { return true; } for (Class<?> constraintGroup : constraint.getGroups()) { if (validatorGroups.contains(constraintGroup)) { return true; } } } return false; }
Source:
public void setUp() throws Exception { when(environment.metrics()).thenReturn(metricRegistry); when(environment.lifecycle()).thenReturn(lifecycleEnvironment); config = new DataSourceFactory(); config.setUrl("jdbc:hsqldb:mem:DbTest-" + System.currentTimeMillis()); config.setUser("sa"); config.setDriverClass("org.hsqldb.jdbcDriver"); config.setValidationQuery("SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS"); HashMap<String, String> props = new HashMap<>(); props.put("hibernate.show_sql", "true"); props.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); config.setProperties(props); }

Target:
public void setUp() throws Exception { when(environment.metrics()).thenReturn(metricRegistry); when(environment.lifecycle()).thenReturn(lifecycleEnvironment); config = new DataSourceFactory(); config.setUrl("jdbc:hsqldb:mem:DbTest-" + System.currentTimeMillis()); config.setUser("sa"); config.setDriverClass("org.hsqldb.jdbcDriver"); config.setValidationQuery("SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS"); config.setProperties(ImmutableMap.<String, String>builder(). put("hibernate.show_sql", "true"). put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"). build()); }
Source:
protected BuddyConnectMessage(BuddyInfoParameters buddyInfoParameters, String message, UUID buddyId, Set<UserDevice> devices) { super(buddyInfoParameters, message); this.buddyId = buddyId; List<UserDevice> sortedDevices = devices.stream() .sorted((d1, d2) -> d1.getDeviceAnonymizedId().compareTo(d2.getDeviceAnonymizedId())) .collect(Collectors.toList()); this.deviceNames = buildDeviceNamesString(sortedDevices); this.deviceAnonymizedIds = buildDeviceAnonymizedIdsString(sortedDevices); this.deviceVpnConnectionStatuses = buildDeviceVpnConnectionStatusesString(sortedDevices); }

Target:
protected BuddyConnectMessage(BuddyInfoParameters buddyInfoParameters, String message, UUID buddyId, Set<UserDevice> devices) { super(buddyInfoParameters, message); this.buddyId = buddyId; List<UserDevice> orderedDevices = new ArrayList<>(devices); this.deviceNames = buildDeviceNamesString(orderedDevices); this.deviceAnonymizedIds = buildDeviceAnonymizedIdsString(orderedDevices); this.deviceVpnConnectionStatuses = buildDeviceVpnConnectionStatusesString(orderedDevices); }
Source:
public boolean supports(DataHolder dataHolder) { return dataHolder instanceof net.minecraft.entity.Entity; }

Target:
public boolean supports(DataHolder dataHolder) { return dataHolder instanceof Entity; }
Source:
private void write(String user, Path path) { byte[] fileContents = getNextFileContents(); Path dirName = path.getParent(); String fileName = path.getFileName().toString(); Map<Path, List<String>> dirsToFiles = index.getDirToFiles(user); List<String> existingFiles = dirsToFiles.get(dirName); if (! existingFiles.contains(fileName)) { existingFiles.add(fileName); } FileSystem testFileSystem = fileSystems.getTestFileSystem(user); FileSystem referenceFileSystem = fileSystems.getReferenceFileSystem(user); testFileSystem.write(path, fileContents); referenceFileSystem.write(path, fileContents); }

Target:
private void write(String user, Path path) { byte[] fileContents = getNextFileContents(); Path dirName = path.getParent(); String fileName = path.getFileName().toString(); Map<Path, Set<String>> dirsToFiles = index.getDirToFiles(user); Set<String> existingFiles = dirsToFiles.get(dirName); existingFiles.add(fileName); FileSystem testFileSystem = fileSystems.getTestFileSystem(user); FileSystem referenceFileSystem = fileSystems.getReferenceFileSystem(user); testFileSystem.write(path, fileContents); referenceFileSystem.write(path, fileContents); }
Source:
protected void putUpdateStoredBlock(StoredBlock storedBlock, boolean wasUndoable) throws SQLException { try { PreparedStatement s = conn.get().prepareStatement(getInsertHeadersSQL()); byte[] hashBytes = new byte[28]; System.arraycopy(storedBlock.getHeader().getHash().getBytes(), 4, hashBytes, 0, 28); s.setBytes(1, hashBytes); s.setBytes(2, storedBlock.getChainWork().toByteArray()); s.setInt(3, storedBlock.getHeight()); s.setBytes(4, storedBlock.getHeader().getTransactions() == null ? storedBlock.getHeader().unsafeBitcoinSerialize() : storedBlock.getHeader().cloneAsHeader().unsafeBitcoinSerialize()); s.setBoolean(5, wasUndoable); s.executeUpdate(); s.close(); } catch (SQLException e) { if (!(e.getSQLState().equals(getDuplicateKeyErrorCode())) || !wasUndoable) throw e; PreparedStatement s = conn.get().prepareStatement(getUpdateHeadersSQL()); s.setBoolean(1, true); byte[] hashBytes = new byte[28]; System.arraycopy(storedBlock.getHeader().getHash().getBytes(), 4, hashBytes, 0, 28); s.setBytes(2, hashBytes); s.executeUpdate(); s.close(); } }

Target:
protected void putUpdateStoredBlock(StoredBlock storedBlock, boolean wasUndoable) throws SQLException { try { PreparedStatement s = conn.get().prepareStatement(getInsertHeadersSQL()); byte[] hashBytes = new byte[28]; System.arraycopy(storedBlock.getHeader().getHash().getBytes(), 4, hashBytes, 0, 28); s.setBytes(1, hashBytes); s.setBytes(2, storedBlock.getChainWork().toByteArray()); s.setInt(3, storedBlock.getHeight()); s.setBytes(4, storedBlock.getHeader().cloneAsHeader().unsafeBitcoinSerialize()); s.setBoolean(5, wasUndoable); s.executeUpdate(); s.close(); } catch (SQLException e) { if (!(e.getSQLState().equals(getDuplicateKeyErrorCode())) || !wasUndoable) throw e; PreparedStatement s = conn.get().prepareStatement(getUpdateHeadersSQL()); s.setBoolean(1, true); byte[] hashBytes = new byte[28]; System.arraycopy(storedBlock.getHeader().getHash().getBytes(), 4, hashBytes, 0, 28); s.setBytes(2, hashBytes); s.executeUpdate(); s.close(); } }
Source:
private void purge() throws HCatException { HCatClient hcatClient = null; if (Conduit.isHCatEnabled()) { hcatClient = getHCatClient(); if (hcatClient == null) { return; } } try { Iterator it = streamsToPurge.iterator(); Path purgePath = null; while (it.hasNext()) { purgePath = (Path) it.next(); if (pathPartitionDescMap.containsKey(purgePath)) { HCatAddPartitionDesc partDesc = pathPartitionDescMap.get(purgePath); if (partDesc != null) { LOG.info("Droping the partition : " + partDesc); hcatClient.dropPartitions(partDesc.getDatabaseName(), partDesc.getTableName(), partDesc.getPartitionSpec(), true); } } try { fs.delete(purgePath, true); LOG.info("Purging [" + purgePath + "]"); ConduitMetrics.updateSWGuage(getServiceType(), PURGEPATHS_COUNT, getName(), 1); } catch (Exception e) { LOG.warn("Cannot delete path " + purgePath, e); ConduitMetrics.updateSWGuage(getServiceType(), DELETE_FAILURES_COUNT, getName(), 1); } } } finally { submitBack(hcatClient); } }

Target:
private void purge() throws HCatException, InterruptedException { HCatClient hcatClient = null; if (Conduit.isHCatEnabled()) { hcatClient = getHCatClient(); if (hcatClient == null) { LOG.warn("Did not get hcat client hence not purging the partitions and paths"); ConduitMetrics.updateSWGuage(getServiceType(), FAILED_TO_GET_HCAT_CLIENT_COUNT, getName(), 1); return; } } try { Iterator it = streamsToPurge.iterator(); Path purgePath = null; while (it.hasNext()) { purgePath = (Path) it.next(); if (pathPartitionDescMap.containsKey(purgePath)) { HCatAddPartitionDesc partDesc = pathPartitionDescMap.get(purgePath); if (partDesc != null) { LOG.info("Droping the partition : " + partDesc.getLocation() + " from " + partDesc.getTableName() + " table"); try { hcatClient.dropPartitions(partDesc.getDatabaseName(), partDesc.getTableName(), partDesc.getPartitionSpec(), false); ConduitMetrics.updateSWGuage(getServiceType(), HCAT_PURGED_PARTITION_COUNT, getName(), 1); } catch (HCatException hcatException) { if (hcatException.getCause() instanceof NoSuchObjectException) { LOG.info("partition " + partDesc.getLocation() + " does not" + " exists in " + partDesc.getTableName() + " table"); } else { ConduitMetrics.updateSWGuage(getServiceType(), HCAT_PURGE_PARTITION_FAILURES_COUNT, getName(), 1); ConduitMetrics.updateSWGuage(getServiceType(), HCAT_CONNECTION_FAILURES, getName(), 1); throw hcatException; } } } } try { LOG.info("Purging [" + purgePath + "]"); fs.delete(purgePath, true); ConduitMetrics.updateSWGuage(getServiceType(), PURGEPATHS_COUNT, getName(), 1); } catch (Exception e) { LOG.warn("Cannot delete path " + purgePath, e); ConduitMetrics.updateSWGuage(getServiceType(), DELETE_FAILURES_COUNT, getName(), 1); } } } finally { addToPool(hcatClient); } }
Source:
public void createFieldEditors() { final Composite parent = getFieldEditorParent(); filePathTemp = new DirectoryFieldEditor(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER, Messages.getString("ComponentsPreferencePage.directoryFieldLabel"), parent); addField(filePathTemp); filePathTemp.getTextControl(parent).addModifyListener(new ModifyListener() { String oldPath = getPreferenceStore().getString(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER); @Override public void modifyText(ModifyEvent e) { String newPath = filePathTemp.getTextControl(parent).getText(); File file = new File(newPath); if (!file.exists() && !"".equals(newPath)) { filePathTemp.showErrorMessage(); setValid(false); } else { if (oldPath.equals(newPath)) { setValid(true); return; } if (!StringUtils.isEmpty(newPath)) { if (!checkUserComponentsFolder(file)) { filePathTemp.getTextControl(parent).setText(oldPath); } } setValid(true); } } }); if (PluginChecker.isPreviewPluginLoaded()) { createForDataViewer(parent); } createForMapper(parent); createFortRunJob(parent); if (PluginChecker.isJobLetPluginLoaded()) { createForJoblet(parent); } createForComponentAssist(parent); if (PluginChecker.isTIS()) { createForHelpType(parent); } parent.pack(); }

Target:
public void createFieldEditors() { final Composite parent = getFieldEditorParent(); filePathTemp = new DirectoryFieldEditor(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER, Messages.getString("ComponentsPreferencePage.directoryFieldLabel"), parent); addField(filePathTemp); filePathTemp.getTextControl(parent).addModifyListener(new ModifyListener() { String oldPath = getPreferenceStore().getString(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER); @Override public void modifyText(ModifyEvent e) { String newPath = filePathTemp.getTextControl(parent).getText(); File file = new File(newPath); if (!file.exists() && !"".equals(newPath)) { filePathTemp.showErrorMessage(); setValid(false); } else { if (oldPath.equals(newPath)) { setValid(true); return; } if (!StringUtils.isEmpty(newPath)) { if (!checkUserComponentsFolder(file)) { filePathTemp.getTextControl(parent).setText(oldPath); } } setValid(true); } } }); if (PluginChecker.isPreviewPluginLoaded()) { createForDataViewer(parent); } createForMapper(parent); createFortRunJob(parent); if (PluginChecker.isJobLetPluginLoaded()) { createForJoblet(parent); } createForComponentAssist(parent); if (ComponentsHelpUtil.isEnabledOnLineHelp()) { createForHelpType(parent); } parent.pack(); }
Source:
public static CommonTokenStream getTokenStream(File inputFile) throws IOException, ArgumentParserException { FileInputStream inputStream = new FileInputStream(inputFile); SwiftLexer lexer = new SwiftLexer(new ANTLRInputStream(inputStream)); if (!argumentParser.debugFlagSet()) { lexer.removeErrorListeners(); lexer.addErrorListener(new ErrorListener()); } try { return new CommonTokenStream(lexer); } catch (ErrorListener.ParseException e) { return null; } }

Target:
public static CommonTokenStream getTokenStream(File inputFile) throws IOException, ArgumentParserException { FileInputStream inputStream = new FileInputStream(inputFile); SwiftLexer lexer = new SwiftLexer(new ANTLRInputStream(inputStream)); if (!argumentParser.debugFlagSet()) { lexer.removeErrorListeners(); lexer.addErrorListener(new ErrorListener()); } return new CommonTokenStream(lexer); }
Source:
public ConfigureLocalStorageModel() { setStorage(new LocalStorageModel()); setDataCenter(new DataCenterModel()); getDataCenter().getVersion().getSelectedItemChangedEvent().addListener(this); setCluster(new ClusterModel()); getCluster().init(false); setFormattedStorageName(new EntityModel()); Frontend.getInstance().getQueryStartedEvent().addListener(this); Frontend.getInstance().getQueryCompleteEvent().addListener(this); Frontend.getInstance().subscribe(new VdcQueryType[] { VdcQueryType.Search, VdcQueryType.GetVdsGroupsByStoragePoolId, VdcQueryType.GetAllVdsGroups, VdcQueryType.GetVdsGroupById, VdcQueryType.GetStoragePoolById, }); for (Boolean bool : getDataCenter().getStoragePoolType().getItems()) { if (bool == Boolean.TRUE) { getDataCenter().getStoragePoolType().setSelectedItem(bool); break; } } setIsGeneralTabValid(true); }

Target:
public ConfigureLocalStorageModel() { setStorage(new LocalStorageModel()); setDataCenter(new DataCenterModel()); getDataCenter().getVersion().getSelectedItemChangedEvent().addListener(this); setCluster(new ClusterModel()); getCluster().init(false); setFormattedStorageName(new EntityModel()); Frontend.getInstance().getQueryStartedEvent().addListener(this); Frontend.getInstance().getQueryCompleteEvent().addListener(this); Frontend.getInstance().subscribe(new VdcQueryType[] { VdcQueryType.Search, VdcQueryType.GetVdsGroupsByStoragePoolId, VdcQueryType.GetAllVdsGroups, VdcQueryType.GetVdsGroupById, VdcQueryType.GetStoragePoolById, }); for (Boolean bool : getDataCenter().getStoragePoolType().getItems()) { if (bool) { getDataCenter().getStoragePoolType().setSelectedItem(bool); break; } } setIsGeneralTabValid(true); }
Source:
protected AuthType getMinAuthLevel() { return AuthType.PUBLIC; }

Target:
protected AuthType getMinAuthLevel() { return AuthType.LOGGED_IN; }
Source:
public boolean isOnline() { if (status == Type.AVAILABLE || status == Type.AWAY) return true; return false; }

Target:
public boolean isOnline() { return status == Type.AVAILABLE || status == Type.AWAY; }
Source:
public ElasticSearchAdapter() { if (client != null) { return; } if (!isSearchEndpointConfigured()) { LOGGER.info("no valid elasticsearch endpoint configured."); return; } try { int portSeparator = endpoint.lastIndexOf(':'); String host = endpoint.substring(0, portSeparator); int port = Integer.parseInt(endpoint.substring(portSeparator + 1), 10); client = new PreBuiltTransportClient(Settings.builder() .put("cluster.name", "elasticsearch").build()) .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(host), port)); } catch (UnknownHostException e) { LOGGER.warn("No elasticsearch cluster running."); } }

Target:
public ElasticSearchAdapter() { if (client != null) { return; } if (!isSearchEndpointConfigured()) { LOGGER.info("no valid elasticsearch endpoint configured."); return; } try { int portSeparator = endpoint.lastIndexOf(':'); String host = endpoint.substring(0, portSeparator); int port = Integer.parseInt(endpoint.substring(portSeparator + 1), 10); client = new PreBuiltTransportClient(Settings.builder() .put("cluster.name", clusterName).build()) .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(host), port)); } catch (UnknownHostException e) { LOGGER.warn("No elasticsearch cluster running."); } catch (Throwable e) { LOGGER.error("Could not connect to Elastic Search Engine", e); } }
Source:
private List<SubDirectiveValueToken> splitByWSP(@Nonnull Token token) { List<SubDirectiveValueToken> tokens = new ArrayList<>(); @Nullable Location startLocation = token.startLocation; if (startLocation == null) { for (String s : WSP.split(token.value)) { tokens.add(new SubDirectiveValueToken(s)); } } else { Matcher m = NotWSP.matcher(token.value); int offset = 0; while (m.find(offset)) { SubDirectiveValueToken dv = new SubDirectiveValueToken(token.value.substring(m.start(), m.end())); dv.startLocation = new Location(startLocation.line, startLocation.column + m.start(), startLocation.offset + m.start()); dv.endLocation = new Location(startLocation.line, startLocation.column + m.end(), startLocation.offset + m.end()); offset = m.end(); tokens.add(dv); } } return tokens; }

Target:
private static List<SubDirectiveValueToken> splitByWSP(@Nonnull Token token) { List<SubDirectiveValueToken> tokens = new ArrayList<>(); @Nullable Location startLocation = token.startLocation; if (startLocation == null) { for (String s : WSP.split(trimRHSWS(token.value))) { tokens.add(new SubDirectiveValueToken(s)); } } else { Matcher m = NotWSP.matcher(token.value); int offset = 0; while (m.find(offset)) { SubDirectiveValueToken dv = new SubDirectiveValueToken(token.value.substring(m.start(), m.end())); dv.startLocation = new Location(startLocation.line, startLocation.column + m.start(), startLocation.offset + m.start()); dv.endLocation = new Location(startLocation.line, startLocation.column + m.end(), startLocation.offset + m.end()); offset = m.end(); tokens.add(dv); } } return tokens; }
Source:
public void onLocationChanged(Location location) { if (location == null) { return; } if (mMapActivity != null) { mMapActivity.get().setUserPositionAt(location); ClientPrefs.getInstance().setSimulationLat((float) location.getLatitude()); ClientPrefs.getInstance().setSimulationLon((float) location.getLongitude()); } }

Target:
public void onLocationChanged(Location location) { if (location == null) { return; } if (mMapActivity != null) { mMapActivity.get().setUserPositionAt(location); ClientPrefs cPrefs = ClientPrefs.getInstance(); if (cPrefs.isDefaultSimulationLatLon()) { cPrefs.setSimulationLat((float) location.getLatitude()); cPrefs.setSimulationLon((float) location.getLongitude()); cPrefs.wroteSimulationLatLon(); } } }
Source:
private static int contextTypes(IConfigurationElement cfgEl) { IConfigurationElement[] contextElements = cfgEl.getChildren(ELEM_CONTEXT); if (contextElements.length == 0) { return BUILD; } int context = 0; for (IConfigurationElement contextElement : contextElements) { String contextType = contextElement.getAttribute(ATTR_TYPE); context = context | ErrorParserContext.getValue(contextType); } return context; }

Target:
private static int contextTypes(IConfigurationElement cfgEl) { IConfigurationElement[] contextElements = cfgEl.getChildren(ELEM_CONTEXT); if (contextElements.length == 0) { return BUILD; } int contexts = 0; for (IConfigurationElement contextElement : contextElements) { String contextType = contextElement.getAttribute(ATTR_TYPE); contexts = contexts | ErrorParserContext.getValue(contextType); } return contexts; }
Source:
private void runWithRetries(Runnable block, SimpleResponseObserver responseObserver) throws IOException { for (int attemptedRetries = 0; ; attemptedRetries++) { block.run(); if (responseObserver.hasError()) { if (attemptedRetries >= UPLOAD_RETRIES) { throw new IOException( String.format("Failed to start resumable upload for '%s'", resourceId), responseObserver.getError()); } continue; } else { break; } } }

Target:
private void runWithRetries(Runnable block, SimpleResponseObserver responseObserver) throws IOException { for (int attemptedRetries = 0; attemptedRetries < UPLOAD_RETRIES; attemptedRetries++) { block.run(); if (!responseObserver.hasError()) { return; } } throw new IOException( String.format("Failed to start resumable upload for '%s'", resourceId), responseObserver.getError()); }
Source:
public <R> Streamlet<R> newSource(IRichSpout spout) { StreamletImpl<R> retval = StreamletImpl.createSpoutStreamlet(spout); retval.setNumPartitions(1); sources.add(retval); return retval; }

Target:
public <R> Streamlet<R> newSource(IRichSpout spout) { StreamletUtils.require(spout != null, "spout must not be null."); StreamletImpl<R> retval = StreamletImpl.createSpoutStreamlet(spout); sources.add(retval); return retval; }
Source:
public Optional<IndexedEmbeddedBindingContext> addIndexedEmbeddedIfIncluded( MappableTypeModel parentTypeModel, boolean multiValued, String relativePrefix, ObjectFieldStorage storage, Integer maxDepth, Set<String> includePaths) { return nestingContext.addIndexedEmbeddedIfIncluded( parentTypeModel, relativePrefix, maxDepth, includePaths, new NestedContextBuilderImpl( indexSchemaRootNodeBuilder, indexSchemaObjectNodeBuilder, storage, isMultiValuedFromParentNotPropagated() || multiValued ) ); }

Target:
public Optional<IndexedEmbeddedBindingContext> addIndexedEmbeddedIfIncluded( MappableTypeModel parentTypeModel, boolean multiValued, String relativePrefix, ObjectFieldStorage storage, Integer maxDepth, Set<String> includePaths) { return nestingContext.addIndexedEmbeddedIfIncluded( parentTypeModel, relativePrefix, maxDepth, includePaths, new NestedContextBuilderImpl( indexSchemaRootNodeBuilder, indexSchemaObjectNodeBuilder, storage, isParentMultivaluedAndWithoutObjectField() || multiValued ) ); }
Source:
public void testMessageWithEmptyArray() throws Exception { Foo foo = Foo.newBuilder().setInt32(5).setBool(true).build(); ByteArrayOutputStream bao = new ByteArrayOutputStream(); ProtobufDatumWriter<Foo> w = new ProtobufDatumWriter<>(Foo.class); Encoder e = EncoderFactory.get().binaryEncoder(bao, null); w.write(foo, e); e.flush(); Object o = new ProtobufDatumReader<>(Foo.class).read(null, DecoderFactory.get().binaryDecoder(new ByteArrayInputStream(bao.toByteArray()), null)); assertEquals(foo, o); }

Target:
public void testMessageWithEmptyArray() throws Exception { Foo foo = Foo.newBuilder().setInt32(5).setBool(true).build(); ByteArrayOutputStream bao = new ByteArrayOutputStream(); ProtobufDatumWriter<Foo> w = new ProtobufDatumWriter<>(Foo.class); Encoder e = EncoderFactory.get().binaryEncoder(bao, null); w.write(foo, e); e.flush(); Foo o = new ProtobufDatumReader<>(Foo.class).read(null, DecoderFactory.get().binaryDecoder(new ByteArrayInputStream(bao.toByteArray()), null)); assertEquals(foo.getInt32(), o.getInt32()); assertEquals(foo.getBool(), o.getBool()); assertEquals(0, o.getFooArrayCount()); }
Source:
final static public < A extends LongAccess > ArrayImg< Unsigned12BitType, A > unsigned12Bits( final A access, final long... dim ) { final ArrayImg< Unsigned12BitType, A > img = new ArrayImg<>( access, dim, new Fraction( 1, 64 ) ); final Unsigned12BitType t = new Unsigned12BitType( img ); img.setLinkedType( t ); return img; }

Target:
final static public < A extends LongAccess > ArrayImg< Unsigned12BitType, A > unsigned12Bits( final A access, final long... dim ) { final ArrayImg< Unsigned12BitType, A > img = new ArrayImg<>( access, dim, new Fraction( 12, 64 ) ); final Unsigned12BitType t = new Unsigned12BitType( img ); img.setLinkedType( t ); return img; }
Source:
public void deserializeRawResource() throws Exception { RawResource resource = new RawResource("ID", "FOO", "FEED", "BAR", null, Collections.singletonList( new Metric("metric", "m.metric", MetricUnit.BYTES, "sum($metric)", new HashMap<>(), new HashMap<>())), Collections.singletonMap("r.prop", "r.val1"), Collections.singletonMap("r.cfg", "r.val2")); String jsonResource = objectMapper.writeValueAsString(resource); RawResource deserialized = objectMapper.readValue(jsonResource, RawResource.class); assertThat(deserialized).isNotNull(); assertThat(deserialized.getId()).isEqualTo("ID"); assertThat(deserialized.getMetrics()).extracting(Metric::getDisplayName).containsExactly("metric"); assertThat(deserialized.getMetrics()).extracting(Metric::getExpression).containsExactly("sum($metric)"); assertThat(deserialized.getProperties()).containsOnly(entry("r.prop", "r.val1")); assertThat(deserialized.getConfig()).containsOnly(entry("r.cfg", "r.val2")); }

Target:
public void deserializeRawResource() throws Exception { RawResource resource = new RawResource("ID", "FOO", "FEED", "BAR", null, Collections.singletonList( new Metric("metric", "m.metric", MetricUnit.BYTES, "sum(m.metric)", new HashMap<>(), new HashMap<>())), Collections.singletonMap("r.prop", "r.val1"), Collections.singletonMap("r.cfg", "r.val2")); String jsonResource = objectMapper.writeValueAsString(resource); RawResource deserialized = objectMapper.readValue(jsonResource, RawResource.class); assertThat(deserialized).isNotNull(); assertThat(deserialized.getId()).isEqualTo("ID"); assertThat(deserialized.getMetrics()).extracting(Metric::getDisplayName).containsExactly("metric"); assertThat(deserialized.getMetrics()).extracting(Metric::getExpression).containsExactly("sum(m.metric)"); assertThat(deserialized.getProperties()).containsOnly(entry("r.prop", "r.val1")); assertThat(deserialized.getConfig()).containsOnly(entry("r.cfg", "r.val2")); }
Source:
public boolean existIndexByColumns(String databaseName, String tableName, String[] columnNames) throws CatalogException { Connection conn = null; ResultSet res = null; PreparedStatement pstmt = null; boolean exist = false; try { int databaseId = getDatabaseId(databaseName); int tableId = getTableId(databaseId, databaseName, tableName); Schema relationSchema = new Schema(getTable(databaseName, tableName).getSchema()); String sql = "SELECT " + COL_INDEXES_PK + " FROM " + TB_INDEXES + " WHERE " + COL_DATABASES_PK + "=? AND " + COL_TABLES_PK + "=? AND COLUMN_NAMES=?"; if (LOG.isDebugEnabled()) { LOG.debug(sql); } String FQUnifiedColumnName = CatalogUtil.buildFQName(databaseName, tableName, CatalogUtil.getUnifiedSimpleColumnName(new Schema(relationSchema), columnNames)); conn = getConnection(); pstmt = conn.prepareStatement(sql); pstmt.setInt(1, databaseId); pstmt.setInt(2, tableId); pstmt.setString(3, FQUnifiedColumnName); res = pstmt.executeQuery(); exist = res.next(); } catch (SQLException se) { throw new CatalogException(se); } finally { CatalogUtil.closeQuietly(pstmt, res); } return exist; }

Target:
public boolean existIndexByColumns(String databaseName, String tableName, String[] columnNames) throws CatalogException { Connection conn = null; ResultSet res = null; PreparedStatement pstmt = null; boolean exist = false; try { int databaseId = getDatabaseId(databaseName); int tableId = getTableId(databaseId, databaseName, tableName); Schema relationSchema = new Schema(getTable(databaseName, tableName).getSchema()); String sql = "SELECT " + COL_INDEXES_PK + " FROM " + TB_INDEXES + " WHERE " + COL_DATABASES_PK + "=? AND " + COL_TABLES_PK + "=? AND COLUMN_NAMES=?"; if (LOG.isDebugEnabled()) { LOG.debug(sql); } String unifiedName = CatalogUtil.buildFQName(databaseName, tableName, CatalogUtil.getUnifiedSimpleColumnName(new Schema(relationSchema), columnNames)); conn = getConnection(); pstmt = conn.prepareStatement(sql); pstmt.setInt(1, databaseId); pstmt.setInt(2, tableId); pstmt.setString(3, unifiedName); res = pstmt.executeQuery(); exist = res.next(); } catch (SQLException se) { throw new CatalogException(se); } finally { CatalogUtil.closeQuietly(pstmt, res); } return exist; }
Source:
public Map<Integer, Integer> getStudyIdEnvironmentDatasetIdMap(final List<Integer> studyIds) { try { final Map<Integer, Integer> studyIdEnvironmentDatasetIdMap = new HashMap<>(); final String sqlString = "SELECT study_id AS studyId, project_id AS projectId FROM project " + " where dataset_type_id = " + DatasetTypeEnum.SUMMARY_DATA.getId() + " AND study_id IN (:studyIds)"; final SQLQuery sqlQuery = this.getSession().createSQLQuery(sqlString); sqlQuery.addScalar("studyId", new IntegerType()); sqlQuery.addScalar("projectId", new IntegerType()); sqlQuery.setParameterList("studyIds", studyIds); sqlQuery.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); final List<Map<String, Object>> results = sqlQuery.list(); for (final Map<String, Object> result : results) { studyIdEnvironmentDatasetIdMap.put((Integer) result.get("studyId"), (Integer) result.get("projectId")); } return studyIdEnvironmentDatasetIdMap; } catch (final HibernateException e) { throw new MiddlewareQueryException("Error getting getObservationLevelsMap for studyIds=" + studyIds + ":" + e.getMessage(), e); } }

Target:
public Map<Integer, Integer> getStudyIdEnvironmentDatasetIdMap(final List<Integer> studyIds) { try { final Map<Integer, Integer> studyIdEnvironmentDatasetIdMap = new HashMap<>(); final String sqlString = "SELECT study_id AS studyId, project_id AS projectId FROM project " + " where dataset_type_id = " + DatasetTypeEnum.SUMMARY_DATA.getId() + " AND study_id IN (:studyIds)"; final SQLQuery sqlQuery = this.getSession().createSQLQuery(sqlString); sqlQuery.addScalar("studyId", new IntegerType()); sqlQuery.addScalar("projectId", new IntegerType()); sqlQuery.setParameterList("studyIds", studyIds); sqlQuery.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); final List<Map<String, Object>> results = sqlQuery.list(); for (final Map<String, Object> result : results) { studyIdEnvironmentDatasetIdMap.put((Integer) result.get("studyId"), (Integer) result.get("projectId")); } return studyIdEnvironmentDatasetIdMap; } catch (final HibernateException e) { throw new MiddlewareQueryException("Error getting getStudyIdEnvironmentDatasetIdMap for studyIds=" + studyIds + ":" + e.getMessage(), e); } }
Source:
private ShardOrganizationManager createShardOrganizationManager(long intervalMillis) { StorageManagerConfig config = new StorageManagerConfig(); return new ShardOrganizationManager(dbi, "node1", createShardManager(dbi), createShardOrganizer(), new TemporalFunctionFactory(config), true, new Duration(intervalMillis, MILLISECONDS)); }

Target:
private ShardOrganizationManager createShardOrganizationManager(long intervalMillis) { return new ShardOrganizationManager(dbi, "node1", createShardManager(dbi), createShardOrganizer(), TEMPORAL_FUNCTION, true, new Duration(intervalMillis, MILLISECONDS)); }
Source:
public void visitSwitchStatement(SwitchStatementTree tree) { Set<Tree> caseExpressions = new HashSet<>(); for (CaseClauseTree caseClause : Iterables.filter(tree.cases(), CaseClauseTree.class)) { addCaseExpression(caseExpressions, caseClause.expression()); } ControlFlowGraph cfg = getControlFlowGraph(tree); SwitchClauseTree previousClauseWithStatement = null; for (SwitchClauseTree switchClause : tree.cases()) { if (previousClauseWithStatement != null && (canBeFallenInto(switchClause, cfg, caseExpressions) || !hasNonEmptyStatement(previousClauseWithStatement))) { addIssue(previousClauseWithStatement, MESSAGE); } if (!switchClause.statements().isEmpty()) { previousClauseWithStatement = switchClause; } } super.visitSwitchStatement(tree); }

Target:
public void visitSwitchStatement(SwitchStatementTree tree) { Set<Tree> caseExpressions = new HashSet<>(); for (CaseClauseTree caseClause : Iterables.filter(tree.cases(), CaseClauseTree.class)) { addCaseExpression(caseExpressions, caseClause.expression()); } ControlFlowGraph cfg = getControlFlowGraph(tree); SwitchClauseTree previousClauseWithStatement = null; for (SwitchClauseTree switchClause : tree.cases()) { if (previousClauseWithStatement != null && (canBeFallenInto(switchClause, cfg, caseExpressions) || hasOnlyEmptyStatements(previousClauseWithStatement))) { addIssue(previousClauseWithStatement.keyword(), MESSAGE); } if (!switchClause.statements().isEmpty()) { previousClauseWithStatement = switchClause; } } super.visitSwitchStatement(tree); }
Source:
public ValueAndTimestamp<V> priorValueForBuffered(final K key) { final Bytes serializedKey = Bytes.wrap(keySerde.serializer().serialize(changelogTopic, key)); final BufferKey bufferKey = index.get(serializedKey); if (bufferKey == null) { throw new NoSuchElementException("Key [" + key + "] is not in the buffer."); } else { final BufferValue bufferValue = sortedMap.get(bufferKey); final byte[] bytes = bufferValue.priorValue(); final V deserialize = valueSerde.innerSerde().deserializer().deserialize(changelogTopic + "-prior", bytes); return ValueAndTimestamp.make(deserialize, RecordQueue.UNKNOWN); } }

Target:
public Maybe<ValueAndTimestamp<V>> priorValueForBuffered(final K key) { final Bytes serializedKey = Bytes.wrap(keySerde.serializer().serialize(changelogTopic, key)); if (index.containsKey(serializedKey)) { final byte[] serializedValue = internalPriorValueForBuffered(serializedKey); final V deserializedValue = valueSerde.innerSerde().deserializer().deserialize( changelogTopic, serializedValue ); return Maybe.defined(ValueAndTimestamp.make(deserializedValue, RecordQueue.UNKNOWN)); } else { return Maybe.undefined(); } }
Source:
public boolean visit(CssRule x, Context ctx) { List<CssProperty> properties = x.getProperties(); for (CssProperty cssProperty : properties) { if (propertyNamesToSkip.contains(cssProperty.getName())) { continue; } String cssPropertyString = cssProperty.getValues().toCss(); Matcher matcher = pattern.matcher(cssPropertyString); boolean needsUpdate = false; while (matcher.find()) { String upperCaseString = matcher.group(); if (!gssContantNames.contains(upperCaseString)) { System.err.println("[WARN] '" + cssProperty.getName() + "' from rule '" + x.getSelectors().toString() + "' since it uses an undefined constant: " + upperCaseString); if (lenient) { System.err.println( "[WARN] turning to lower case. This is probably not what you wanted here in the first place!"); cssPropertyString = cssPropertyString.replace(upperCaseString, upperCaseString.toLowerCase()); needsUpdate = true; } break; } } if (needsUpdate) { needsUpdate = false; cssProperty.setValue(new SimpleValue(cssPropertyString)); } } return false; }

Target:
public boolean visit(CssRule x, Context ctx) { List<CssProperty> properties = x.getProperties(); for (CssProperty cssProperty : properties) { if (propertyNamesToSkip.contains(cssProperty.getName())) { continue; } String cssPropertyString = cssProperty.getValues().toCss(); Matcher matcher = pattern.matcher(cssPropertyString); boolean needsUpdate = false; while (matcher.find()) { String upperCaseString = matcher.group(); if (!gssContantNames.contains(upperCaseString)) { System.err.println("[WARN] '" + cssProperty.getName() + "' from rule '" + x.getSelectors().toString() + "' since it uses an undefined constant: " + upperCaseString); if (lenient) { System.err.println( "[WARN] turning to lower case. This is probably not what you wanted here in the first place!"); cssPropertyString = cssPropertyString.replace(upperCaseString, upperCaseString.toLowerCase()); needsUpdate = true; } else { throw new Css2GssConversionException("Found undefined constant in input. " + cssProperty.getName() + "' from rule '" + x.getSelectors().toString() + "' undefined constant: " + upperCaseString); } break; } } if (needsUpdate) { needsUpdate = false; cssProperty.setValue(new SimpleValue(cssPropertyString)); } } return false; }
Source:
public boolean onCommand(CommandPerformEvent event) { StringBuilder b = new StringBuilder(); for (int i = 1; i < event.getArgs().length; i++) { if (i != 1) b.append(" "); b.append(event.getArgs()[i]); } Nexus.getInstance().sendMessage(event.getArgs()[0], b.toString()); return true; }

Target:
public boolean onCommand(CommandPerformEvent event) { if (event.getArgs().length < 2){ return false; }else{ String message = StringUtil.combineSplit(1, event.getArgs(), " "); Nexus.getInstance().sendMessage(event.getArgs()[0], message); return true; } }
Source:
private boolean isScheduled() { long lastStatsUpdateTime = asyncIndexesSizeStatsUpdate.getLastStatsUpdateTime(indexPath); long defaultStatsUpdateTime = asyncIndexesSizeStatsUpdate.getScheduleTimeInMillis(); return (System.currentTimeMillis() > lastStatsUpdateTime + defaultStatsUpdateTime); }

Target:
private boolean isScheduled() { long lastStatsUpdateTime = asyncIndexesSizeStatsUpdate.getLastStatsUpdateTime(indexPath); long defaultStatsUpdateTime = asyncIndexesSizeStatsUpdate.getScheduleTimeInMillis(); return System.currentTimeMillis() > lastStatsUpdateTime + defaultStatsUpdateTime; }
Source:
public org.codice.solr.client.solrj.SolrClient newClient(String core) { checkConfig(); LOGGER.debug( "Solr({}): Creating a Solr Cloud client using Zookeeper hosts [{}]", core, zookeeperHosts); SolrClientAdapter adaptor = new SolrClientAdapter(core, () -> createSolrCloudClient(zookeeperHosts, core)); try { if (!adaptor.isAvailable(30, 5, TimeUnit.SECONDS)) { LOGGER.warn("Solr Client is not available after 30 seconds", core); } } catch (InterruptedException e) { LOGGER.error("Unable to connect to solr client {}: ", core, e.getStackTrace()); } return adaptor; }

Target:
public org.codice.solr.client.solrj.SolrClient newClient(String core) { checkConfig(); LOGGER.debug( "Solr({}): Creating a Solr Cloud client using Zookeeper hosts [{}]", core, zookeeperHosts); SolrClientAdapter adaptor = new SolrClientAdapter(core, () -> createSolrCloudClient(zookeeperHosts, core)); try { if (!adaptor.isAvailable(30, 5, TimeUnit.SECONDS)) { LOGGER.warn("Solr Client is not available after 30 seconds", core); } } catch (InterruptedException e) { LOGGER.error("Unable to connect to solr client {}: ", core, e.getStackTrace()); Thread.currentThread().interrupt(); } return adaptor; }
Source:
private Cost checkElement(IType type, IValue initialValue, Cost worstCost) throws DOMException { IType nestedType = SemanticUtil.getNestedType(type, SemanticUtil.TDEF); if (fIndex >= fInitializers.length) return checkInitializationFromDefaultMemberInitializer(nestedType, initialValue, worstCost); worstCost = new Cost(fInitializers[fIndex].getType(), nestedType, Rank.IDENTITY); if (fInitializers[fIndex].isInitializerList() || !isAggregate(nestedType) || sameType(nestedType, fInitializers[fIndex].getType())) { ICPPEvaluation initializer = fInitializers[fIndex]; fIndex++; Cost cost = Conversions.checkImplicitConversionSequence(nestedType, initializer.getType(), initializer.getValueCategory(), UDCMode.ALLOWED, Context.ORDINARY); if (!cost.converts()) { return cost; } if (!(initializer.isConstantExpression()) && cost.isNarrowingConversion()) { return Cost.NO_CONVERSION; } if (cost.compareTo(worstCost) > 0) { worstCost = cost; } } else { Cost cost = checkInitializationOfElements(nestedType, worstCost); if (!cost.converts()) return cost; if (cost.compareTo(worstCost) > 0) { worstCost = cost; } } return worstCost; }

Target:
private Cost checkElement(IType type, IValue initialValue, Cost worstCost) throws DOMException { IType nestedType = SemanticUtil.getNestedType(type, SemanticUtil.TDEF); if (fIndex >= fInitializers.length) return checkInitializationFromDefaultMemberInitializer(nestedType, initialValue, worstCost); worstCost = new Cost(fInitializers[fIndex].getType(), nestedType, Rank.IDENTITY); if (initFromStringLiteral(nestedType, fInitializers[fIndex])) { Cost cost = new Cost(fInitializers[fIndex].getType(), nestedType, Rank.CONVERSION); fIndex++; if (cost.compareTo(worstCost) > 0) { worstCost = cost; } } else if (fInitializers[fIndex].isInitializerList() || !isAggregate(nestedType)) { ICPPEvaluation initializer = fInitializers[fIndex]; fIndex++; Cost cost = Conversions.checkImplicitConversionSequence(nestedType, initializer.getType(), initializer.getValueCategory(), UDCMode.ALLOWED, Context.ORDINARY); if (!cost.converts()) { return cost; } if (!(initializer.isConstantExpression()) && cost.isNarrowingConversion()) { return Cost.NO_CONVERSION; } if (cost.compareTo(worstCost) > 0) { worstCost = cost; } } else { Cost cost = checkInitializationOfElements(nestedType, worstCost); if (!cost.converts()) return cost; if (cost.compareTo(worstCost) > 0) { worstCost = cost; } } return worstCost; }
Source:
public MesosClientBuilder<Send, Receive> onBackpressureBuffer( ) { this.byteStreamTransformer = observable -> observable.onBackpressureBuffer(); return this; }

Target:
public MesosClientBuilder<Send, Receive> onBackpressureBuffer( ) { this.backpressureTransformer = observable -> observable.onBackpressureBuffer(); return this; }
Source:
private void stageSchemaFiles(Configuration config){ if (config.m_userSchema == null){ return; } assert( config.m_userSchema.isFile() ); File stagedCatalog = new VoltFile(getStagedCatalogPath()); if (!config.m_forceVoltdbCreate && stagedCatalog.exists() && stagedCatalog.canRead()){ VoltDB.crashLocalVoltDB("Staged catalog from \"init\" or a previous database is present, but \"voltdb init --force\" was not specified."); } final boolean standalone = true; final boolean isXCDR = false; VoltCompiler compiler = new VoltCompiler(standalone, isXCDR); if (!compiler.compileFromDDL(stagedCatalog.getAbsolutePath(), config.m_userSchema.getAbsolutePath())){ VoltDB.crashLocalVoltDB("Could not compile specified schema " + config.m_userSchema, false, null); } }

Target:
private void stageSchemaFiles(Configuration config) { if (config.m_userSchema == null) { return; } assert( config.m_userSchema.isFile() ); File stagedCatalogFH = new VoltFile(getStagedCatalogPath(getVoltDBRootPath())); if (!config.m_forceVoltdbCreate && stagedCatalogFH.exists()) { VoltDB.crashLocalVoltDB("A previous database was initialized with a schema. You must init with --force to overwrite the schema."); } final boolean standalone = true; final boolean isXCDR = false; final boolean generateReports = false; VoltCompiler compiler = new VoltCompiler(standalone, isXCDR, generateReports); if (!compiler.compileFromDDL(stagedCatalogFH.getAbsolutePath(), config.m_userSchema.getAbsolutePath())) { VoltDB.crashLocalVoltDB("Could not compile specified schema " + config.m_userSchema); } }