auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setUp() throws Exception { utils = ResourceUtils.create(this, "mycontext"); BasicHttpProcessor httpProcessor = new BasicHttpProcessor(); httpProcessor.addInterceptor(new ResponseServer()); httpProcessor.addInterceptor(new ResponseContent()); httpProcessor.addInterceptor(new ResponseConnControl()); httpProcessor.addInterceptor(new RequestBasicAuth()); httpProcessor.addInterceptor(new ResponseBasicUnauthorized()); server = new LocalTestServer(httpProcessor, null); server.register("/simple", new SimpleResponseHandler("OK")); server.register("/empty", new SimpleResponseHandler(HttpStatus.SC_NO_CONTENT, "")); server.register("/missing", new SimpleResponseHandler(HttpStatus.SC_NOT_FOUND, "Missing")); server.register("/redirect", new SimpleResponseHandler(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect", new BasicHeader("Location", "/simple"))); server.register("/cycle", new SimpleResponseHandler(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect", new BasicHeader("Location", "/cycle"))); server.register("/secure", new SimpleResponseHandler(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect", new BasicHeader("Location", "<LINK_0>"))); server.register("/auth", new AuthHandler("test", "test", "OK")); server.start(); InetSocketAddress addr = server.getServiceAddress(); baseUrl = "http://" + addr.getHostName() + ":" + addr.getPort(); }

Target:
public void setUp() throws Exception { utils = ResourceUtils.create(this, "mycontext"); BasicHttpProcessor httpProcessor = new BasicHttpProcessor(); httpProcessor.addInterceptor(new ResponseServer()); httpProcessor.addInterceptor(new ResponseContent()); httpProcessor.addInterceptor(new ResponseConnControl()); httpProcessor.addInterceptor(new RequestBasicAuth()); httpProcessor.addInterceptor(new ResponseBasicUnauthorized()); server = new LocalTestServer(httpProcessor, null); server.register("/simple", new SimpleResponseHandler("OK")); server.register("/empty", new SimpleResponseHandler(HttpStatus.SC_NO_CONTENT, "")); server.register("/missing", new SimpleResponseHandler(HttpStatus.SC_NOT_FOUND, "Missing")); server.register("/redirect", new SimpleResponseHandler(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect", new BasicHeader("Location", "/simple"))); server.register("/cycle", new SimpleResponseHandler(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect", new BasicHeader("Location", "/cycle"))); server.register("/secure", new SimpleResponseHandler(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect", new BasicHeader("Location", "<LINK_0>"))); server.register("/auth", new AuthHandler("test", "test", "OK")); server.register("/auth_escape", new AuthHandler("test@me:/", "test", "OK")); server.register("/auth_escape2", new AuthHandler("test@me:test", "", "OK")); server.register("/no_credentials", new CheckNoCredentials()); server.start(); InetSocketAddress addr = server.getServiceAddress(); baseUrl = "http://" + addr.getHostName() + ":" + addr.getPort(); }
Source:
public static OutputStream createFileOutputStream(String filename, SecretKeySpec symetricKey) throws FileNotFoundException { final File path = new File(filename); FileOutputStream fos = new FileOutputStream(path); if (symetricKey == null) { return fos; } else { try { Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, symetricKey); return new CipherOutputStream(fos, cipher); } catch (InvalidKeyException e) { e.printStackTrace(); Logger.log(AndroidLogger.TYPE_ERROR_CRYPTO, "Invalid key: " + e.getMessage()); throw new RuntimeException(e.getMessage()); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); Logger.log(AndroidLogger.TYPE_ERROR_CRYPTO, "Unavailable Crypto algorithm: " + e.getMessage()); throw new RuntimeException(e.getMessage()); } catch (NoSuchPaddingException e) { e.printStackTrace(); Logger.log(AndroidLogger.TYPE_ERROR_CRYPTO, "Bad Padding: " + e.getMessage()); throw new RuntimeException(e.getMessage()); } } }

Target:
public static OutputStream createFileOutputStream(String filename, SecretKeySpec symetricKey) throws FileNotFoundException { final File path = new File(filename); FileOutputStream fos = new FileOutputStream(path); if (symetricKey == null) { return fos; } else { try { Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, symetricKey); return new BufferedOutputStream(new CipherOutputStream(fos, cipher)); } catch (InvalidKeyException e) { e.printStackTrace(); Logger.log(AndroidLogger.TYPE_ERROR_CRYPTO, "Invalid key: " + e.getMessage()); throw new RuntimeException(e.getMessage()); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); Logger.log(AndroidLogger.TYPE_ERROR_CRYPTO, "Unavailable Crypto algorithm: " + e.getMessage()); throw new RuntimeException(e.getMessage()); } catch (NoSuchPaddingException e) { e.printStackTrace(); Logger.log(AndroidLogger.TYPE_ERROR_CRYPTO, "Bad Padding: " + e.getMessage()); throw new RuntimeException(e.getMessage()); } } }
Source:
private ResultSet getTableMetaData( String schema, String table ) throws KettleDatabaseException { ResultSet tables = null; if ( getDatabaseMetaData() == null ) { throw new KettleDatabaseException( BaseMessages.getString( PKG, "Database.Error.UnableToGetDbMeta" ) ); } try { tables = databaseMeta.getDatabaseInterface().getTables( getDatabaseMetaData(), databaseMeta, schema, table, TABLE_TYPES_TO_GET ); } catch ( SQLException e ) { throw new KettleDatabaseException( BaseMessages.getString( PKG, "Database.Error.UnableToGetTableNames" ), e ); } if ( tables == null ) { throw new KettleDatabaseException( BaseMessages.getString( PKG, "Database.Error.UnableToGetTableNames" ) ); } return tables; }

Target:
private ResultSet getTableMetaData( String schema, String table ) throws KettleDatabaseException { ResultSet tables = null; if ( getDatabaseMetaData() == null ) { throw new KettleDatabaseException( BaseMessages.getString( PKG, "Database.Error.UnableToGetDbMeta" ) ); } try { tables = databaseMeta.getTables( getDatabaseMetaData(), schema, table, TABLE_TYPES_TO_GET ); } catch ( SQLException e ) { throw new KettleDatabaseException( BaseMessages.getString( PKG, "Database.Error.UnableToGetTableNames" ), e ); } if ( tables == null ) { throw new KettleDatabaseException( BaseMessages.getString( PKG, "Database.Error.UnableToGetTableNames" ) ); } return tables; }
Source:
private void addProjectReference(Map<String,String> entryInfos) { String repoLocation = (String) entryInfos.get(KEY_REPO); String path = (String) entryInfos.get(KEY_PATH); String projectName = (String) entryInfos.get(KEY_ELEMENT_NAME); String tag = (String) entryInfos.get(IFetchFactory.KEY_ELEMENT_TAG); if (repoLocation != null && projectName != null) { String sourceUrl = asReference(repoLocation, path, projectName, tag); if (sourceUrl != null) { entryInfos.put(Constants.KEY_SOURCE_REFERENCES, sourceUrl); } } }

Target:
private void addProjectReference(Map<String, String> entryInfos) { final String repoLocation = entryInfos.get(KEY_REPO); final String path = entryInfos.get(KEY_PATH); final String projectName = entryInfos.get(KEY_ELEMENT_NAME); final String tag = entryInfos.get(IFetchFactory.KEY_ELEMENT_TAG); if (repoLocation != null && projectName != null) { final String sourceUrl = asReference(repoLocation, path, projectName, tag); if (sourceUrl != null) { entryInfos.put(Constants.KEY_SOURCE_REFERENCES, sourceUrl); } } }
Source:
private void notifyPostSelectDoubleClick() { notify(SWT.MouseDown, createMouseEvent(1, SWT.NONE, 2)); notify(SWT.MouseDoubleClick, createMouseEvent(1, SWT.NONE, 2)); notify(SWT.DefaultSelection); notify(SWT.MouseUp, createMouseEvent(1, SWT.BUTTON1, 2)); notify(SWT.Deactivate, super.createEvent()); notify(SWT.FocusOut, super.createEvent()); notify(SWT.MouseExit, createMouseEvent(0, SWT.NONE, 0)); }

Target:
private void notifyPostSelectDoubleClick() { notify(SWT.MouseDown, createMouseEvent(1, SWT.NONE, 2)); notify(SWT.MouseDoubleClick, createMouseEvent(1, SWT.NONE, 2)); notify(SWT.DefaultSelection); notify(SWT.MouseUp, createMouseEvent(1, SWT.BUTTON1, 2)); }
Source:
private static boolean hasNotGoneThroughAuthorisation(ChargeEntity charge) { return charge.getEvents().stream() .map(ChargeEventEntity::getStatus) .noneMatch(status -> postAuthorisationReadyStates.contains(status)); }

Target:
private static boolean hasNotGoneThroughAuthorisation(ChargeEntity charge) { return charge.getEvents().stream() .map(ChargeEventEntity::getStatus) .noneMatch(PaymentCreatedEventDetails::containsPostAuthorisationReadyStatus); }
Source:
private boolean canCreateBlockCompresedIndexedFastaSequence(final Path path) { try (final InputStream stream = new BufferedInputStream(Files.newInputStream(path))) { if(BlockCompressedInputStream.isValidFile(stream)) { return Files.exists(GZIIndex.resolveIndexNameForBgzipFile(path)); } } catch (IOException e) { return false; } return false; }

Target:
private static boolean canCreateBlockCompresedIndexedFastaSequence(final Path path) { try (final InputStream stream = new BufferedInputStream(Files.newInputStream(path))) { if(BlockCompressedInputStream.isValidFile(stream)) { return Files.exists(GZIIndex.resolveIndexNameForBgzipFile(path)); } } catch (IOException e) { return false; } return false; }
Source:
public String getTestSrc() { return testSrcs.get(0); }

Target:
public String getTestSrc() { return testSrcs.isEmpty() ? null : testSrcs.get(0); }
Source:
public void testSelectInformationSchemaColumns() { assertQuery( "SELECT table_schema FROM information_schema.columns WHERE table_schema = 'tpch' ORDER BY table_schema LIMIT 1", "VALUES 'tpch'"); assertQuery( "SELECT table_name FROM information_schema.columns WHERE table_name = 'orders' ORDER BY table_name LIMIT 1", "VALUES 'orders'"); }

Target:
public void testSelectInformationSchemaColumns() { String catalog = getSession().getCatalog().get(); String schema = getSession().getSchema().get(); String schemaPattern = schema.replaceAll(".$", "_"); @Language("SQL") String ordersTableWithColumns = "VALUES " + "('orders', 'orderkey'), " + "('orders', 'custkey'), " + "('orders', 'orderstatus'), " + "('orders', 'totalprice'), " + "('orders', 'orderdate'), " + "('orders', 'orderpriority'), " + "('orders', 'clerk'), " + "('orders', 'shippriority'), " + "('orders', 'comment')"; assertQuery("SELECT table_schema FROM information_schema.columns WHERE table_schema = '" + schema + "' GROUP BY table_schema", "VALUES '" + schema + "'"); assertQuery("SELECT table_name FROM information_schema.columns WHERE table_name = 'orders' GROUP BY table_name", "VALUES 'orders'"); assertQuery("SELECT table_name, column_name FROM information_schema.columns WHERE table_schema = '" + schema + "' AND table_name = 'orders'", ordersTableWithColumns); assertQuery("SELECT table_name, column_name FROM information_schema.columns WHERE table_schema = '" + schema + "' AND table_name LIKE '%rders'", ordersTableWithColumns); assertQuery("SELECT table_name, column_name FROM information_schema.columns WHERE table_schema LIKE '" + schemaPattern + "' AND table_name LIKE '_rder_'", ordersTableWithColumns); assertQuery( "SELECT table_name, column_name FROM information_schema.columns " + "WHERE table_catalog = '" + catalog + "' AND table_schema = '" + schema + "' AND table_name LIKE '%orders%'", ordersTableWithColumns); assertQuery("SELECT column_name FROM information_schema.columns WHERE table_catalog = 'something_else'", "SELECT '' WHERE false"); }
Source:
private long copyPackBypassCache(PackOutputStream out, DfsReader ctx, MessageDigest md) throws IOException { try (ReadableChannel rc = ctx.db.openFile(packDesc, PACK)) { ByteBuffer buf = newCopyBuffer(out, rc, ctx); long position = 12; long remaining = length - (12 + 20); while (0 < remaining) { DfsBlock b = cache.get(key, alignToBlock(position)); if (b != null) { int ptr = (int) (position - b.start); int n = (int) Math.min(b.size() - ptr, remaining); b.write(out, position, n, md); position += n; remaining -= n; rc.position(position); continue; } buf.position(0); int n = read(rc, buf); if (n <= 0) { setInvalid(); throw new IOException(MessageFormat.format( JGitText.get().packfileIsTruncated, getPackName())); } if (n > remaining) n = (int) remaining; out.write(buf.array(), 0, n); if (md != null) md.update(buf.array(), 0, n); position += n; remaining -= n; } return position; } }

Target:
private long copyPackBypassCache(PackOutputStream out, DfsReader ctx, MessageDigest md) throws IOException { try (ReadableChannel rc = ctx.db.openFile(packDesc, PACK)) { ByteBuffer buf = newCopyBuffer(out, rc, ctx); long position = 12; long remaining = length - (12 + 20); while (0 < remaining) { DfsBlock b = cache.get(key, alignToBlock(position)); if (b != null) { int ptr = (int) (position - b.start); int n = (int) Math.min(b.size() - ptr, remaining); b.write(out, position, n, md); position += n; remaining -= n; rc.position(position); continue; } buf.position(0); int n = read(rc, buf); if (n <= 0) throw packfileIsTruncated(); else if (n > remaining) n = (int) remaining; out.write(buf.array(), 0, n); if (md != null) md.update(buf.array(), 0, n); position += n; remaining -= n; } return position; } }
Source:
public void testCacheEventNotificationServiceConfigurationTest() throws Exception { final URL resource = XmlConfigurationTest.class.getResource("/configs/ehcache-cacheEventNotification.xml"); XmlConfiguration xmlConfig = new XmlConfiguration(resource); assertThat(xmlConfig.getCacheConfigurations().size(), is(2)); Collection<?> configuration = xmlConfig.getCacheConfigurations().get("bar").getServiceConfigurations(); checkEventNotificationConfigurationExists(configuration); Collection<?> templateConfiguration = xmlConfig.getCacheConfigurations().get("foo").getServiceConfigurations(); checkEventNotificationConfigurationExists(templateConfiguration); DefaultCacheEventNotificationServiceConfiguration factoryConfiguration = null; for (Object o : configuration) { if(o instanceof DefaultCacheEventNotificationServiceConfiguration) { factoryConfiguration = (DefaultCacheEventNotificationServiceConfiguration)o; } } assertNotNull(factoryConfiguration); assertThat(factoryConfiguration.getNumberOfEventProcessingQueues(), is(5)); }

Target:
public void testCacheEventNotificationServiceConfigurationTest() throws Exception { final URL resource = XmlConfigurationTest.class.getResource("/configs/ehcache-cacheEventNotification.xml"); XmlConfiguration xmlConfig = new XmlConfiguration(resource); assertThat(xmlConfig.getCacheConfigurations().size(), is(2)); DefaultCacheEventNotificationServiceConfiguration factoryConfiguration = ServiceLocator.findSingletonAmongst( DefaultCacheEventNotificationServiceConfiguration.class, xmlConfig.getCacheConfigurations().get("foo") .getServiceConfigurations().toArray()); assertNotNull(factoryConfiguration); assertThat(factoryConfiguration.getNumberOfEventProcessingQueues(), is(5)); }
Source:
public void writeData(SliceOutput sliceOutput) { for (long offset : stripeOffsets) { sliceOutput.writeLong(offset); } }

Target:
public void writeData(SliceOutput sliceOutput) { for (long offset : stripeOffsets) { sliceOutput.writeLong(offset); } sliceOutput.writeInt(toIntExact(size())); }
Source:
public void accept(GcsEvent gcsEvent, Context context) throws RuntimeException { String bucket = gcsEvent.getBucket(); if (bucket == null) { throw new IllegalArgumentException("Missing bucket parameter"); } String filename = gcsEvent.getName(); if (filename == null) { throw new IllegalArgumentException("Missing name parameter"); } detectText(bucket, filename); }

Target:
public void accept(GcsEvent gcsEvent, Context context) { String bucket = gcsEvent.getBucket(); if (bucket == null) { throw new IllegalArgumentException("Missing bucket parameter"); } String filename = gcsEvent.getName(); if (filename == null) { throw new IllegalArgumentException("Missing name parameter"); } detectText(bucket, filename); }
Source:
public void testDisableBeforeDelayedInitialization() throws Exception { provider = createProvider(); Map<String, Object> props = new HashMap<>(); props.put("enabled", "true"); provider.activate(props); verify(linkRegistry, never()).addRegistryChangeListener(same(provider.linkRegistryListener)); verify(itemRegistry, never()).addRegistryHook(same(provider.itemRegistryListener)); props = new HashMap<>(); props.put("enabled", "false"); provider.modified(props); Thread.sleep(2500); verify(linkRegistry, never()).addRegistryChangeListener(same(provider.linkRegistryListener)); verify(itemRegistry, never()).addRegistryHook(same(provider.itemRegistryListener)); }

Target:
public void testDisableBeforeDelayedInitialization() throws Exception { provider = createProvider(); reset(linkRegistry); Field field = ChannelItemProvider.class.getDeclaredField("INITIALIZATION_DELAY_NANOS"); field.setAccessible(true); Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); field.set(provider, TimeUnit.MILLISECONDS.toNanos(40)); Map<String, Object> props = new HashMap<>(); props.put("enabled", "true"); provider.activate(props); provider.linkRegistryListener.added(new ItemChannelLink(ITEM_NAME, CHANNEL_UID)); verify(listener, never()).added(same(provider), same(ITEM)); verify(linkRegistry, never()).getAll(); props = new HashMap<>(); props.put("enabled", "false"); provider.modified(props); Thread.sleep(100); provider.linkRegistryListener.added(new ItemChannelLink(ITEM_NAME, CHANNEL_UID)); verify(listener, never()).added(same(provider), same(ITEM)); verify(linkRegistry, never()).getAll(); }
Source:
private void unpackPostIntent(@NonNull Intent intent) { PostModel post = mPostStore.getPostByLocalPostId(intent.getIntExtra(KEY_LOCAL_POST_ID, 0)); if (post != null) { boolean shouldTrackAnalytics = intent.getBooleanExtra(KEY_SHOULD_TRACK_ANALYTICS, false); if (shouldTrackAnalytics) { mPostUploadHandler.registerPostForAnalyticsTracking(post); } if (!hasPendingOrInProgressMediaUploadsForPost(post)) { mPostUploadHandler.upload(post); } else { List<MediaModel> pendingMedia = MediaUploadHandler.getPendingOrInProgressMediaUploadsForPost(post); UploadingPost uploadingPost = new UploadingPost(post, pendingMedia); sPostsWithPendingMedia.add(uploadingPost); showNotificationForPostWithPendingMedia(post); } } }

Target:
private void unpackPostIntent(@NonNull Intent intent) { PostModel post = mPostStore.getPostByLocalPostId(intent.getIntExtra(KEY_LOCAL_POST_ID, 0)); if (post != null) { boolean shouldTrackAnalytics = intent.getBooleanExtra(KEY_SHOULD_TRACK_ANALYTICS, false); if (shouldTrackAnalytics) { mPostUploadHandler.registerPostForAnalyticsTracking(post); } if (!hasPendingOrInProgressMediaUploadsForPost(post)) { mPostUploadHandler.upload(post); } else { for (UploadingPost uploadingPost : sPostsWithPendingMedia) { if (uploadingPost.postModel.getId() == post.getId()) { uploadingPost.postModel = post; uploadingPost.isCancelled = false; Set<MediaModel> totalPendingMedia = new HashSet<>(); totalPendingMedia.addAll(uploadingPost.pendingMedia); totalPendingMedia.addAll(MediaUploadHandler.getPendingOrInProgressMediaUploadsForPost(post)); uploadingPost.pendingMedia = new ArrayList<>(totalPendingMedia); showNotificationForPostWithPendingMedia(post); return; } } UploadingPost uploadingPost = new UploadingPost(post, MediaUploadHandler.getPendingOrInProgressMediaUploadsForPost(post)); sPostsWithPendingMedia.add(uploadingPost); showNotificationForPostWithPendingMedia(post); } } }
Source:
public SecurityIdentity authenticate(Principal principal, Evidence evidence) throws RealmUnavailableException, SecurityException { final SecurityManager securityManager = System.getSecurityManager(); if (securityManager != null) { securityManager.checkPermission(AUTHENTICATE); } ServerAuthenticationContext serverAuthenticationContext = new ServerAuthenticationContext(this, MechanismConfigurationSelector.constantSelector(MechanismConfiguration.EMPTY)); if (principal != null) serverAuthenticationContext.setAuthenticationPrincipal(principal); if (serverAuthenticationContext.verifyEvidence(evidence)) { if (serverAuthenticationContext.authorize()) { Credential credential = evidence.asCredential(); if (credential != null) { serverAuthenticationContext.addPrivateCredential(credential); } else { log.tracef("Evidence [%s] does not map to any credential type. Credentials are not available from authorized identity and identity propagation may not work", evidence.getClass().getName()); } serverAuthenticationContext.succeed(); return serverAuthenticationContext.getAuthorizedIdentity(); } else { serverAuthenticationContext.fail(); throw log.authenticationFailedAuthorization(); } } else { serverAuthenticationContext.fail(); throw log.authenticationFailedEvidenceVerification(); } }

Target:
public SecurityIdentity authenticate(Principal principal, Evidence evidence) throws RealmUnavailableException, SecurityException { final SecurityManager securityManager = System.getSecurityManager(); if (securityManager != null) { securityManager.checkPermission(AUTHENTICATE); } ServerAuthenticationContext serverAuthenticationContext = new ServerAuthenticationContext(this, MechanismConfigurationSelector.constantSelector(MechanismConfiguration.EMPTY)); if (principal != null) serverAuthenticationContext.setAuthenticationPrincipal(principal); if (serverAuthenticationContext.verifyEvidence(evidence)) { if (serverAuthenticationContext.authorize()) { if (evidence instanceof PasswordGuessEvidence) { PasswordGuessEvidence passwordGuessEvidence = PasswordGuessEvidence.class.cast(evidence); serverAuthenticationContext.addPrivateCredential(new PasswordCredential(ClearPassword.createRaw(ClearPassword.ALGORITHM_CLEAR, passwordGuessEvidence.getGuess()))); } else if (evidence instanceof BearerTokenEvidence) { BearerTokenEvidence tokenEvidence = BearerTokenEvidence.class.cast(evidence); serverAuthenticationContext.addPrivateCredential(new BearerTokenCredential(tokenEvidence.getToken())); } else { log.tracef("Evidence [%s] does not map to a supported credential type. Credentials are not available from authorized identity and identity propagation may not work", evidence.getClass().getName()); } serverAuthenticationContext.succeed(); return serverAuthenticationContext.getAuthorizedIdentity(); } else { serverAuthenticationContext.fail(); throw log.authenticationFailedAuthorization(); } } else { serverAuthenticationContext.fail(); throw log.authenticationFailedEvidenceVerification(); } }
Source:
public static int countOutgoing( NodeCursor nodeCursor, RelationshipGroupCursor group, int type ) { nodeCursor.relationships( group ); int count = 0; while ( group.next() ) { if ( group.type() == type ) { count += group.outgoingCount() + group.loopCount(); } } return count; }

Target:
public static int countOutgoing( NodeCursor nodeCursor, RelationshipGroupCursor group, int type ) { nodeCursor.relationships( group ); while ( group.next() ) { if ( group.type() == type ) { return group.outgoingCount() + group.loopCount(); } } return 0; }
Source:
public String getContext() { return command_.getContext().name(); }

Target:
public String getContext() { Context context = command_.getContext(); if (context == Context.Workbench) { return ""; } return context.toString(); }
Source:
private boolean canPromoteFieldInitializer(ClassMemberDeclaration declaration) { if (!NodeUtil.isLiteralValue(declaration.rhs, false)) { return false; } Node fnNode = NodeUtil.getEnclosingFunction(declaration.exprRoot); if (fnNode != null) { String fnName = getFnName(fnNode); if (!"constructor".equals(fnName)) { return false; } } return true; }

Target:
private boolean canPromoteFieldInitializer(ClassMemberDeclaration declaration) { if (!NodeUtil.isLiteralValue(declaration.rhs, false)) { return false; } Node fnNode = NodeUtil.getEnclosingFunction(declaration.exprRoot); if (fnNode != null) { String fnName = getEnclosingFunctionName(fnNode); if (!"constructor".equals(fnName)) { return false; } } return true; }
Source:
public void run() { while (this.active.get()) { QueueEntry queueEntry = null; try { queueEntry = this.queue.peek(); if ((queueEntry != null) && (Time.currentTimeMillis() >= queueEntry.endTimeMs)) { this.queue.remove(queueEntry); queueEntry.func.run(); } else if (queueEntry != null) { Time.sleep(Math.min(1000, (queueEntry.endTimeMs - Time.currentTimeMillis()))); } else { Time.sleep(1000); } if(Thread.interrupted()) this.active.set(false); } catch (Throwable e) { if (!(Utils.exceptionCauseIsInstanceOf(InterruptedException.class, e)) && !(Utils.exceptionCauseIsInstanceOf(ClosedByInterruptException.class, e))) { this.onKill.uncaughtException(this, e); this.setActive(false); } } } }

Target:
public void run() { while (this.active.get()) { QueueEntry queueEntry = null; try { queueEntry = this.queue.peek(); if ((queueEntry != null) && (Time.currentTimeMillis() >= queueEntry.endTimeMs)) { this.queue.remove(queueEntry); queueEntry.func.run(); } else if (queueEntry != null) { Time.sleep(Math.min(1000, (queueEntry.endTimeMs - Time.currentTimeMillis()))); } else { Time.sleep(1000); } if (Thread.interrupted()) { this.active.set(false); } } catch (Throwable e) { if (!(Utils.exceptionCauseIsInstanceOf(InterruptedException.class, e)) && !(Utils.exceptionCauseIsInstanceOf(ClosedByInterruptException.class, e))) { this.onKill.uncaughtException(this, e); this.setActive(false); } } } }
Source:
private void onBoardSave() { logger.info("Menu: Boards > Save"); List<PanelInfo> panels = getCurrentPanels(); if (openBoardName.equals("")) { onBoardSaveAs(); } if (panels.isEmpty()) { logger.info("Did not save board " + openBoardName); return; } prefs.addBoard(openBoardName, panels); ui.triggerEvent(new BoardSavedEvent()); logger.info("Board " + openBoardName + " saved"); }

Target:
private void onBoardSave() { logger.info("Menu: Boards > Save"); if (!prefs.getLastOpenBoard().isPresent()) { onBoardSaveAs(); return; } List<PanelInfo> panels = getCurrentPanels(); if (panels.isEmpty()) { logger.info("Did not save board " + prefs.getLastOpenBoard().get()); return; } prefs.addBoard(prefs.getLastOpenBoard().get(), panels); ui.triggerEvent(new BoardSavedEvent()); logger.info("Board " + prefs.getLastOpenBoard().get() + " saved"); }
Source:
public void execute() throws MojoExecutionException, MojoFailureException { long start = System.currentTimeMillis(); getLog().debug("Processing sources..."); if (!lightweightPackage) { RepositoryGenerator repositoryGenerator = new RepositoryGenerator(project.getFile(), outputDirectory, new ArtifactInstaller(getLog()), getClassLoaderModelAssembler()); try { ClassLoaderModel classLoaderModel = repositoryGenerator.generate(); getContentGenerator().createApplicationClassLoaderModelJsonFile(classLoaderModel); } catch (Exception e) { getLog().debug(format("There was an exception while creating the repository of [%s]", project.toString()), e); throw new MojoFailureException(e.getMessage(), e); } } getLog().debug(MessageFormat.format("Process sources done ({0}ms)", System.currentTimeMillis() - start)); }

Target:
public void execute() throws MojoExecutionException, MojoFailureException { long start = System.currentTimeMillis(); getLog().debug("Processing sources..."); if (!lightweightPackage) { RepositoryGenerator repositoryGenerator = new RepositoryGenerator(project.getFile(), outputDirectory, new ArtifactInstaller(getLog()), getClassLoaderModelAssembler()); try { ClassLoaderModel classLoaderModel = repositoryGenerator.generate(); getContentGenerator().createApplicationClassLoaderModelJsonFile(classLoaderModel); } catch (Exception e) { String message = format("There was an exception while creating the repository of [%s]", project.toString()); throw new MojoFailureException(message, e); } } getLog().debug(MessageFormat.format("Process sources done ({0}ms)", System.currentTimeMillis() - start)); }
Source:
public void setup() throws Exception { initMocks(this); when(pid.toString()).thenReturn(PID_STRING); when(dip.getDocument()).thenReturn(idb); when(dip.getPid()).thenReturn(pid); when(dip.getContentObject()).thenReturn(contentObj); when(contentObj.getPid()).thenReturn(pid); when(inheritedAclFactory.isMarkedForDeletion(any(PID.class))).thenReturn(true); principalRoles = new HashMap<>(); principalRoles.put(AccessPrincipalConstants.PUBLIC_PRINC, new HashSet<String>()); when(inheritedAclFactory.getPrincipalRoles(any(PID.class))).thenReturn(principalRoles); when(inheritedAclFactory.getPatronAccess(any(PID.class))).thenReturn(PatronAccess.none); when(objAclFactory.getPatronAccess(any(PID.class))).thenReturn(PatronAccess.none); filter = new SetAccessStatusFilter(); filter.setObjectAclFactory(objAclFactory); filter.setInheritedAclFactory(inheritedAclFactory); }

Target:
public void setup() throws Exception { initMocks(this); when(pid.toString()).thenReturn(PID_STRING); when(dip.getDocument()).thenReturn(idb); when(dip.getPid()).thenReturn(pid); principalRoles = new HashMap<>(); when(inheritedAclFactory.getPatronAccess(any(PID.class))).thenReturn(PatronAccess.parent); when(objAclFactory.getPatronAccess(any(PID.class))).thenReturn(PatronAccess.parent); filter = new SetAccessStatusFilter(); filter.setObjectAclFactory(objAclFactory); filter.setInheritedAclFactory(inheritedAclFactory); }
Source:
private void deleteGroupFamily( EntityId entityId, FamilyLayout familyLayout, long upToTimestamp) throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot delete family group while KijiTableWriter %s is in state %s.", this, state); final String familyName = Preconditions.checkNotNull(familyLayout.getName()); final KijiColumnNameTranslator colNameTranslator = mWriterLayoutCapsule.getColumnNameTranslator(); int i = 0; final int numColumnLayouts = familyLayout.getColumnMap().size(); byte[][] qualifiers = new byte[numColumnLayouts][]; for (ColumnLayout columnLayout : familyLayout.getColumnMap().values()) { final String qualifier = columnLayout.getName(); final KijiColumnName column = new KijiColumnName(familyName, qualifier); final HBaseColumnName hBaseColumnName = colNameTranslator.toHBaseColumnName(column); qualifiers[i] = hBaseColumnName.getQualifier(); i ++; } final HBaseColumnName hbaseColumnName = mWriterLayoutCapsule.getColumnNameTranslator(). toHBaseColumnName(new KijiColumnName(familyName)); final byte[] family = hbaseColumnName.getFamily(); final DeleteRequest delete = new DeleteRequest( Bytes.toBytes(mTable.getName()), entityId.getHBaseRowKey(), family, qualifiers, upToTimestamp); try { mHBClient.delete(delete).join(); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } }

Target:
private void deleteGroupFamily( EntityId entityId, FamilyLayout familyLayout, long upToTimestamp) throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot delete family group while KijiTableWriter %s is in state %s.", this, state); final String familyName = Preconditions.checkNotNull(familyLayout.getName()); final KijiColumnNameTranslator colNameTranslator = mWriterLayoutCapsule.getColumnNameTranslator(); int i = 0; final int numColumnLayouts = familyLayout.getColumnMap().size(); byte[][] qualifiers = new byte[numColumnLayouts][]; for (ColumnLayout columnLayout : familyLayout.getColumnMap().values()) { final String qualifier = columnLayout.getName(); final KijiColumnName column = new KijiColumnName(familyName, qualifier); final HBaseColumnName hbaseColumnName = colNameTranslator.toHBaseColumnName(column); qualifiers[i] = hbaseColumnName.getQualifier(); i ++; } final byte[] hbaseFamilyName = mWriterLayoutCapsule.getColumnNameTranslator() .toHBaseFamilyName(familyLayout.getLocalityGroup()); final DeleteRequest delete = new DeleteRequest( mTableName, entityId.getHBaseRowKey(), hbaseFamilyName, qualifiers, upToTimestamp); try { mHBClient.delete(delete).join(); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } }
Source:
void asyncProcessLevelNodes( final String path, final Processor<String> processor, final AsyncCallback.VoidCallback finalCb, final Object context, final int successRc, final int failureRc) { zk.sync(path, new AsyncCallback.VoidCallback() { @Override public void processResult(int rc, String path, Object ctx) { if (rc == Code.NONODE.intValue()) { finalCb.processResult(successRc, null, context); return; } else if (rc != Code.OK.intValue()) { LOG.error("Error syncing path " + path + " when getting its chidren: ", KeeperException.create(KeeperException.Code.get(rc), path)); finalCb.processResult(failureRc, null, context); return; } zk.getChildren(path, false, new AsyncCallback.ChildrenCallback() { @Override public void processResult(int rc, String path, Object ctx, List<String> levelNodes) { if (rc == Code.NONODE.intValue()) { finalCb.processResult(successRc, null, context); return; } else if (rc != Code.OK.intValue()) { LOG.error("Error polling hash nodes of " + path, KeeperException.create(KeeperException.Code.get(rc), path)); finalCb.processResult(failureRc, null, context); return; } AsyncListProcessor<String> listProcessor = new AsyncListProcessor<String>(scheduler); listProcessor.process(levelNodes, processor, finalCb, context, successRc, failureRc); } }, null); } }, null); }

Target:
void asyncProcessLevelNodes( final String path, final Processor<String> processor, final AsyncCallback.VoidCallback finalCb, final Object context, final int successRc, final int failureRc) { zk.sync(path, new AsyncCallback.VoidCallback() { @Override public void processResult(int rc, String path, Object ctx) { if (rc != Code.OK.intValue()) { LOG.error("Error syncing path " + path + " when getting its chidren: ", KeeperException.create(KeeperException.Code.get(rc), path)); finalCb.processResult(failureRc, null, context); return; } zk.getChildren(path, false, new AsyncCallback.ChildrenCallback() { @Override public void processResult(int rc, String path, Object ctx, List<String> levelNodes) { if (rc != Code.OK.intValue()) { LOG.error("Error polling hash nodes of " + path, KeeperException.create(KeeperException.Code.get(rc), path)); finalCb.processResult(failureRc, null, context); return; } AsyncListProcessor<String> listProcessor = new AsyncListProcessor<String>(scheduler); listProcessor.process(levelNodes, processor, finalCb, context, successRc, failureRc); } }, null); } }, null); }
Source:
@Override public boolean process(Set<? extends TypeElement> types, RoundEnvironment env) { try { if (!env.processingOver()) { for (Element e : env.getElementsAnnotatedWith(Module.class)) { delayedModuleNames.add(e.asType().toString()); } return true; } Set<Element> modules = new HashSet<Element>(); for (String moduleName : delayedModuleNames) { modules.add(processingEnv.getElementUtils().getTypeElement(moduleName)); } for (Element element : modules) { Map<String, Object> annotation = CodeGen.getAnnotation(Module.class, element); if (!annotation.get("complete").equals(Boolean.TRUE)) { continue; } TypeElement moduleType = (TypeElement) element; Map<String, Binding<?>> bindings = processCompleteModule(moduleType); writeDotFile(moduleType, bindings); delayedModuleNames.remove(element.asType().toString()); } } catch (IOException e) { error("Graph processing failed: " + e); } return true; }

Target:
@Override public boolean process(Set<? extends TypeElement> types, RoundEnvironment env) { try { if (!env.processingOver()) { for (Element e : env.getElementsAnnotatedWith(Module.class)) { delayedModuleNames.add(e.asType().toString()); } return true; } Set<Element> modules = new LinkedHashSet<Element>(); for (String moduleName : delayedModuleNames) { modules.add(processingEnv.getElementUtils().getTypeElement(moduleName)); } for (Element element : modules) { Map<String, Object> annotation = CodeGen.getAnnotation(Module.class, element); if (!annotation.get("complete").equals(Boolean.TRUE)) { continue; } TypeElement moduleType = (TypeElement) element; Map<String, Binding<?>> bindings = processCompleteModule(moduleType); writeDotFile(moduleType, bindings); } } catch (IOException e) { error("Graph processing failed: " + e); } return true; }
Source:
protected void initNode(Node node) { node.setBaseTime(TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis())); }

Target:
protected void initNode(Node node) { node.setBaseTime(TimeUnit.NANOSECONDS.toMicros(System.nanoTime())); }
Source:
private List<PotentialAssignment> generateAssignmentsFromTypeAlone(ParameterSignature unassigned) { Class<?> paramType = unassigned.getType(); FromDataPoints fromDataPoints = unassigned.getAnnotation(FromDataPoints.class); if (fromDataPoints == null) { if (paramType.isEnum()) { return new EnumSupplier(paramType).getValueSources(unassigned); } else if (paramType.equals(Boolean.class) || paramType.equals(boolean.class)) { return new BooleanSupplier().getValueSources(unassigned); } } return emptyList(); }

Target:
private List<PotentialAssignment> generateAssignmentsFromTypeAlone(ParameterSignature unassigned) { Class<?> paramType = unassigned.getType(); FromDataPoints fromDataPoints = unassigned.getAnnotation(FromDataPoints.class); if (fromDataPoints == null) { if (paramType.isEnum()) { return new EnumSupplier(paramType).getValueSources(unassigned); } else if (paramType.equals(Boolean.class) || paramType.equals(boolean.class)) { return new BooleanSupplier().getValueSources(unassigned); } } else { return emptyList(); } }
Source:
public static <TClass, TAnnotation extends Annotation> void scanClasspath(Class<TClass> superClass, Class<TAnnotation> annotationClass, String requirePackage, Consumer<Class<? extends TClass>> consumer) { FastClasspathScanner fcs; if (requirePackage != null) { fcs = new FastClasspathScanner(requirePackage); } else { fcs = new FastClasspathScanner(); } ScanResult scanResults = fcs.scan(); List<String> assignableFrom; if (superClass.isInterface()) { assignableFrom = scanResults.getNamesOfClassesImplementing(superClass.getName()); } else { assignableFrom = scanResults.getNamesOfSubclassesOf(superClass.getName()); } List<String> matches = scanResults.getNamesOfClassesWithAnnotation(annotationClass.getName()); if (assignableFrom.size() > 0) { matches.retainAll(assignableFrom); } log.debug("Found " + matches.size() + " classes with annotation '" + annotationClass.getName() + "' and super class '" + superClass.getName() + "'"); for (String className : matches) { Class<?> clazz; try { clazz = Class.forName(className); consumer.accept((Class<? extends TClass>) clazz); } catch (Throwable e) { log.trace("Cannot load class " + className, e); return; } } }

Target:
public static <TClass, TAnnotation extends Annotation> void scanClasspath(Class<TClass> superClass, Class<TAnnotation> annotationClass, String requirePackage, Consumer<Class<? extends TClass>> consumer) { FastClasspathScanner fcs; if (requirePackage != null) { fcs = new FastClasspathScanner(requirePackage); } else { fcs = new FastClasspathScanner(); } ScanResult scanResults = fcs.scan(); List<String> assignableFrom = Collections.EMPTY_LIST; if (superClass != null) { if (superClass.isInterface()) { assignableFrom = scanResults.getNamesOfClassesImplementing(superClass.getName()); } else { assignableFrom = scanResults.getNamesOfSubclassesOf(superClass.getName()); } } List<String> matches = scanResults.getNamesOfClassesWithAnnotation(annotationClass.getName()); if (superClass != null) { matches.retainAll(assignableFrom); log.debug("Found " + matches.size() + " classes with annotation '" + annotationClass.getName() + "' and super class '" + superClass.getName() + "'"); } else { log.debug("Found " + matches.size() + " classes with annotation '" + annotationClass.getName() + "'"); } for (String className : matches) { Class<?> clazz; try { clazz = Class.forName(className); consumer.accept((Class<? extends TClass>) clazz); } catch (Throwable e) { log.error("Cannot load class " + className, e); continue; } } }
Source:
public CompilerOptions getCompilerOptions() { final CompilerOptions options = new CompilerOptions(); options.setClosurePass(true); options.setCheckGlobalNamesLevel(CheckLevel.ERROR); options.setWarningLevel(DiagnosticGroups.DUPLICATE_VARS, CheckLevel.ERROR); options.setLanguage(CompilerOptions.LanguageMode.ECMASCRIPT6_TYPED); options.setLanguageOut(CompilerOptions.LanguageMode.NO_TRANSPILE); options.setWrapGoogModulesForWhitespaceOnly(false); options.setTrustedStrings(true); options.setPreferSingleQuotes(true); options.skipAllCompilerPasses(); setIdeMode(options); return options; }

Target:
public CompilerOptions getCompilerOptions() { final CompilerOptions options = new CompilerOptions(); options.setClosurePass(true); options.setCheckGlobalNamesLevel(CheckLevel.ERROR); options.setWarningLevel(DiagnosticGroups.DUPLICATE_VARS, CheckLevel.ERROR); options.setLanguage(CompilerOptions.LanguageMode.ECMASCRIPT6); options.setLanguageOut(CompilerOptions.LanguageMode.NO_TRANSPILE); options.setWrapGoogModulesForWhitespaceOnly(false); options.setTrustedStrings(true); options.setPreferSingleQuotes(true); options.skipAllCompilerPasses(); setIdeMode(options); return options; }
Source:
public void handleAction(ActionParameters params) throws ActionException { JSONObject jsonPayload = params.getHttpParamAsJSON("featureData"); OskariLayer layer = getLayer(jsonPayload.optString("layerId")); if (!canEdit(layer, params.getUser())) { throw new ActionDeniedException("User doesn't have edit permission for layer: " + layer.getId()); } final WFSLayerConfiguration wfsMetadata = getWFSConfiguration(layer.getId()); final String wfstMessage = createWFSTMessage(jsonPayload, layer, wfsMetadata); LOG.debug("Inserting feature to service at", layer.getUrl(), "with payload", wfstMessage); final String responseString = postPayload(layer, wfstMessage); final String updatedFeatureId = parseFeatureIdFromResponse(responseString); flushLayerTilesCache(layer.getId()); ResponseHelper.writeResponse(params, JSONHelper.createJSONObject("fid", updatedFeatureId)); }

Target:
public void handleAction(ActionParameters params) throws ActionException { params.requireLoggedInUser(); JSONObject jsonPayload = params.getHttpParamAsJSON("featureData"); OskariLayer layer = getLayer(jsonPayload.optString("layerId")); if (!canEdit(layer, params.getUser())) { throw new ActionDeniedException("User doesn't have edit permission for layer: " + layer.getId()); } final WFSLayerConfiguration wfsMetadata = getWFSConfiguration(layer.getId()); final String wfstMessage = createWFSTMessage(jsonPayload, layer, wfsMetadata); LOG.debug("Inserting feature to service at", layer.getUrl(), "with payload", wfstMessage); final String responseString = postPayload(layer, wfstMessage); final String updatedFeatureId = parseFeatureIdFromResponse(responseString); flushLayerTilesCache(layer.getId()); ResponseHelper.writeResponse(params, JSONHelper.createJSONObject("fid", updatedFeatureId)); }
Source:
private void runThread(CountDownLatch latch, VDSReturnValue value, FencingExecutor executor, FenceAgentOrder order, boolean succeeded) { value = executor.Fence(order); if (value.getSucceeded()) { executor = new FencingExecutor(getVds(), FenceActionType.Status); succeeded = waitForStatus(getVds().getvds_name(), getParameters().getAction(), order); latch.countDown(); } }

Target:
private void runThread(CountDownLatch latch, VDSReturnValue value, FencingExecutor executor, FenceAgentOrder order, boolean succeeded) { value = executor.Fence(order); if (value.getSucceeded()) { try { executor = new FencingExecutor(getVds(), FenceActionType.Status); succeeded = waitForStatus(getVds().getvds_name(), getParameters().getAction(), order); } finally { latch.countDown(); } } }
Source:
public WeldSEBeanDeploymentArchive build() { if (beansXml == null) { parseBeansXml(); } return new WeldSEBeanDeploymentArchive(id, classes, beansXml); }

Target:
public WeldSEBeanDeploymentArchive build() { return new WeldSEBeanDeploymentArchive(id, classes, getParsedBeansXml()); }
Source:
public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) { try { this.collector = outputCollector; synchronized (EsAbstractBolt.class) { if (client == null) { client = new StormEsClient(esConfig); } } } catch (Exception e) { logger.warn("unable to initialize ESBolt ", e); } }

Target:
public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) { try { this.collector = outputCollector; synchronized (EsAbstractBolt.class) { if (client == null) { client = new StormEsClient(esConfig); } } } catch (Exception e) { throw new RuntimeException("unable to initialize EsBolt ", e); } }
Source:
public void updatesChangeTransactionStatus() throws Exception { PaymentRequestEntity paymentRequest = PaymentRequestEntityFixture.aValidPaymentRequestEntity() .withTransactions(aChargeTransactionEntity().withStatus(ChargeStatus.CREATED).build()) .build(); when(mockPaymentRequestDao.findByExternalId(someExternalId)).thenReturn(Optional.of(paymentRequest)); ChargeStatus newChargeStatus = ChargeStatus.ENTERING_CARD_DETAILS; new StatusUpdater(mockPaymentRequestDao).updateChargeTransactionStatus(someExternalId, newChargeStatus); assertThat(paymentRequest.getChargeTransaction().getStatus(), is(newChargeStatus)); }

Target:
public void updatesChangeTransactionStatus() throws Exception { PaymentRequestEntity paymentRequest = PaymentRequestEntityFixture.aValidPaymentRequestEntity() .withTransactions(aChargeTransactionEntity().withStatus(ChargeStatus.CREATED).build()) .build(); when(mockPaymentRequestDao.findByExternalId(SOME_EXTERNAL_ID)).thenReturn(Optional.of(paymentRequest)); ChargeStatus newChargeStatus = ENTERING_CARD_DETAILS; new StatusUpdater(mockPaymentRequestDao).updateChargeTransactionStatus(SOME_EXTERNAL_ID, newChargeStatus); assertThat(paymentRequest.getChargeTransaction().getStatus(), is(newChargeStatus)); }
Source:
public BasePoseSubsystem(WPIFactory factory, XPropertyManager propManager) { log.info("Creating"); imu = factory.getGyro(ImuType.navX); currentHeadingProp = propManager.createEphemeralProperty("CurrentHeading", 0.0); lastImuHeading = imu.getYaw(); currentHeading = new ContiguousHeading(FACING_AWAY_FROM_DRIVERS); currentPitch = propManager.createEphemeralProperty("CurrentPitch", 0.0); currentRoll = propManager.createEphemeralProperty("CurrentRoll", 0.0); leftDriveDistance = propManager.createEphemeralProperty("LeftDriveDistance", 0.0); rightDriveDistance = propManager.createEphemeralProperty("RightDriveDistance", 0.0); totalDistanceX = propManager.createEphemeralProperty("TotalDistanceX", 0.0); totalDistanceY = propManager.createEphemeralProperty("TotalDistanceY", 0.0); rioRotated = propManager.createPersistentProperty("RioRotated", false); inherentRioPitch = propManager.createPersistentProperty("InherentRioPitch", 0.0); inherentRioRoll = propManager.createPersistentProperty("InherentRioRoll", 0.0); }

Target:
public BasePoseSubsystem(WPIFactory factory, XPropertyManager propManager) { log.info("Creating"); imu = factory.getGyro(ImuType.navX); currentHeadingProp = propManager.createEphemeralProperty("CurrentHeading", 0.0); currentHeading = new ContiguousHeading(0); setCurrentHeading(FACING_AWAY_FROM_DRIVERS); currentPitch = propManager.createEphemeralProperty("Current pitch", 0.0); currentRoll = propManager.createEphemeralProperty("Current roll", 0.0); leftDriveDistance = propManager.createEphemeralProperty("Left drive distance", 0.0); rightDriveDistance = propManager.createEphemeralProperty("Right drive distance", 0.0); totalDistanceX = propManager.createEphemeralProperty("Total distance X", 0.0); totalDistanceY = propManager.createEphemeralProperty("Total distance Y", 0.0); rioRotated = propManager.createPersistentProperty("RIO rotated", false); inherentRioPitch = propManager.createPersistentProperty("Inherent RIO pitch", 0.0); inherentRioRoll = propManager.createPersistentProperty("Inherent RIO roll", 0.0); }