auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void fixCompositeInputNaming(JsonObject graph, List<List<JsonObject>> startsEndsAndOperators, JsonObject opDefinition) { for(int i = 0; i < startsEndsAndOperators.get(0).size(); i++){ JsonObject start = startsEndsAndOperators.get(0).get(i); if(start.has("config") && (hasAny(object(start, "config"), compOperatorStarts))) continue; String outputPortName = GsonUtilities.jstring(start.get("outputs").getAsJsonArray().get(0).getAsJsonObject(), "name"); for(JsonObject downstream : GraphUtilities.getDownstream(start, graph)){ JsonArray inputs = array(downstream, "inputs"); for(JsonElement inputObj : inputs){ JsonObject input = inputObj.getAsJsonObject(); JsonArray connections = array(input, "connections"); for(int j = 0; j < connections.size(); j++){ if(connections.get(j).getAsString().equals(outputPortName)){ connections.set(j, GsonUtilities.array(opDefinition, "inputNames").get(j)); } } } } } }

Target:
private void fixCompositeInputNaming(JsonObject graph, List<List<JsonObject>> startsEndsAndOperators, JsonObject opDefinition) { for(int i = 0; i < startsEndsAndOperators.get(0).size(); i++){ JsonObject start = startsEndsAndOperators.get(0).get(i); if(start.has("config") && (hasAny(object(start, "config"), compOperatorStarts))) continue; String outputPortName = GsonUtilities.jstring(start.get("outputs").getAsJsonArray().get(0).getAsJsonObject(), "name"); for(JsonObject downstream : GraphUtilities.getDownstream(start, graph)){ JsonArray inputs = array(downstream, "inputs"); for(JsonElement inputObj : inputs){ JsonObject input = inputObj.getAsJsonObject(); JsonArray connections = array(input, "connections"); for(int j = 0; j < connections.size(); j++){ if(connections.get(j).getAsString().equals(outputPortName)){ connections.set(j, GsonUtilities.array(opDefinition, "inputNames").get(i)); } } } } } }
Source:
public Binder<BindJpa, Object> build(BindJpa annotation) { return (q, parameter, bind, arg) -> { final String prefix; if (BindJpa.DEFAULT.equals(bind.value())) { prefix = ""; } else { prefix = bind.value() + "."; } try { JpaClass<?> jpaClass = JpaClass.get(arg.getClass()); for (JpaMember member : jpaClass.members()) { q.dynamicBind(member.getType(), prefix + member.getColumnName(), member.read(arg)); } } catch (Exception e) { throw new IllegalStateException( "unable to bind bean properties", e); } }; }

Target:
public Binder<BindJpa, Object> build(BindJpa annotation) { return (q, parameter, bind, arg) -> { final String prefix; if (BindJpa.DEFAULT.equals(bind.value())) { prefix = ""; } else { prefix = bind.value() + "."; } JpaClass<?> jpaClass = JpaClass.get(arg.getClass()); for (JpaMember member : jpaClass.members()) { q.dynamicBind(member.getType(), prefix + member.getColumnName(), readMember(arg, member)); } }; }
Source:
protected void configure() { bind(BlobStore.class).to(LocalBlobStore.class); install(new BlobStoreObjectModule()); if (System.getProperty("os.name", "").toLowerCase().contains("windows")) bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL); else bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT); bind(LocalStorageStrategy.class).to(FilesystemStorageStrategyImpl.class); bind(BlobUtils.class).to(FileSystemBlobUtilsImpl.class); bind(FilesystemBlobKeyValidator.class).to(FilesystemBlobKeyValidatorImpl.class); bind(FilesystemContainerNameValidator.class).to(FilesystemContainerNameValidatorImpl.class); bind(BlobRequestSigner.class).to(LocalBlobRequestSigner.class); }

Target:
protected void configure() { bind(BlobStore.class).to(LocalBlobStore.class); install(new BlobStoreObjectModule()); if (isWindows()) { bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL); } else { bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT); } bind(LocalStorageStrategy.class).to(FilesystemStorageStrategyImpl.class); bind(BlobUtils.class).to(FileSystemBlobUtilsImpl.class); bind(FilesystemBlobKeyValidator.class).to(FilesystemBlobKeyValidatorImpl.class); bind(FilesystemContainerNameValidator.class).to(FilesystemContainerNameValidatorImpl.class); bind(BlobRequestSigner.class).to(LocalBlobRequestSigner.class); }
Source:
public void trace(String format, Object arg) { if (isTraceEnabled()) { log(TRACE_INT, org.slf4j.helpers.MessageFormatter.format(format, arg).getMessage(), arg); } }

Target:
public void trace(String format, Object arg) { if (isTraceEnabled()) { log(TRACE_INT, org.slf4j.helpers.MessageFormatter.format(format, arg)); } }
Source:
private void showMultiListPageConfirmToggleDialog(@NonNull final ReadingListPage page) { if (getContext() == null) { return; } AlertDialog dialog = new AlertDialog.Builder(getContext()) .setTitle(R.string.reading_list_confirm_remove_article_from_offline_title) .setMessage(getConfirmToggleOfflineMessage(page)) .setPositiveButton(R.string.reading_list_confirm_remove_article_from_offline, new ConfirmRemoveFromOfflineListener(page)) .setNegativeButton(android.R.string.cancel, null) .create(); dialog.show(); TextView text = (TextView) dialog.findViewById(android.R.id.message); text.setLineSpacing(0, 1.3f); }

Target:
private void showMultiListPageConfirmToggleDialog(@NonNull final ReadingListPage page) { if (getActivity() == null) { return; } AlertDialog dialog = new AlertDialog.Builder(getContext()) .setTitle(R.string.reading_list_confirm_remove_article_from_offline_title) .setMessage(getConfirmToggleOfflineMessage(page)) .setPositiveButton(R.string.reading_list_confirm_remove_article_from_offline, new ConfirmRemoveFromOfflineListener(page)) .setNegativeButton(android.R.string.cancel, null) .create(); dialog.show(); TextView text = (TextView) dialog.findViewById(android.R.id.message); text.setLineSpacing(0, 1.3f); }
Source:
public Resource<SVG> decode(InputStream source, int width, int height) throws IOException { try { SVG svg = SVG.getFromInputStream(source); return new SvgResource(svg); } catch (SVGParseException ex) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD) { throw new IOException(ex.toString()); } throw new IOException("Cannot load SVG from stream", ex); } }

Target:
public Resource<SVG> decode(InputStream source, int width, int height) throws IOException { try { SVG svg = SVG.getFromInputStream(source); return new SvgResource(svg); } catch (SVGParseException ex) { throw new IOException("Cannot load SVG from stream", ex); } }
Source:
public static List<ApiImplementor> getAllImplementors() { List<ApiImplementor> imps = new ArrayList<>(); ApiImplementor api; api = new AntiCsrfAPI(null); api.addApiOptions(new AntiCsrfParam()); imps.add(api); imps.add(new PassiveScanAPI(null)); imps.add(new SearchAPI(null)); api = new AutoUpdateAPI(null); api.addApiOptions(new OptionsParamCheckForUpdates()); imps.add(api); api = new SpiderAPI(null); api.addApiOptions(new SpiderParam()); imps.add(api); api = new CoreAPI(); api.addApiOptions(new ConnectionParam()); imps.add(api); imps.add(new ParamsAPI(null)); api = new ActiveScanAPI(null); api.addApiOptions(new ScannerParam()); imps.add(api); imps.add(new ContextAPI()); imps.add(new HttpSessionsAPI(null)); imps.add(new BreakAPI(null)); imps.add(new AuthenticationAPI(null)); imps.add(new AuthorizationAPI()); imps.add(new SessionManagementAPI(null)); imps.add(new UsersAPI(null)); imps.add(new ForcedUserAPI(null)); imps.add(new ScriptAPI(null)); imps.add(new StatsAPI()); return imps; }

Target:
public static List<ApiImplementor> getAllImplementors() { List<ApiImplementor> imps = new ArrayList<>(); ApiImplementor api; api = new AntiCsrfAPI(null); api.addApiOptions(new AntiCsrfParam()); imps.add(api); imps.add(new PassiveScanAPI(null)); imps.add(new SearchAPI(null)); api = new AutoUpdateAPI(null); api.addApiOptions(new OptionsParamCheckForUpdates()); imps.add(api); api = new SpiderAPI(null); api.addApiOptions(new SpiderParam()); imps.add(api); api = new CoreAPI(); api.addApiOptions(new ConnectionParam()); imps.add(api); imps.add(new ParamsAPI(null)); api = new ActiveScanAPI(null); api.addApiOptions(new ScannerParam()); imps.add(api); imps.add(new ContextAPI()); imps.add(new HttpSessionsAPI(null)); imps.add(new BreakAPI(null)); imps.add(new AuthenticationAPI(null)); imps.add(new AuthorizationAPI()); imps.add(new SessionManagementAPI(null)); imps.add(new UsersAPI(null)); imps.add(new ForcedUserAPI(null)); imps.add(new ScriptAPI(null)); api = new StatsAPI(null); api.addApiOptions(new StatsParam()); imps.add(api); return imps; }
Source:
private ProjectSelectedPositions(ConnectorSession session, DriverYieldSignal yieldSignal, LocalMemoryContext memoryContext, Page page, SelectedPositions selectedPositions) { checkArgument(!selectedPositions.isEmpty(), "selectedPositions should not be empty"); this.session = session; this.yieldSignal = yieldSignal; this.page = page; this.memoryContext = memoryContext; this.selectedPositions = selectedPositions; this.previouslyComputedResults = new Block[projections.size()]; }

Target:
private ProjectSelectedPositions(ConnectorSession session, DriverYieldSignal yieldSignal, LocalMemoryContext memoryContext, Page page, SelectedPositions selectedPositions) { checkArgument(!selectedPositions.isEmpty(), "selectedPositions is empty"); this.session = session; this.yieldSignal = yieldSignal; this.page = page; this.memoryContext = memoryContext; this.selectedPositions = selectedPositions; this.previouslyComputedResults = new Block[projections.size()]; }
Source:
public synchronized void reloadFile() throws IOException { System.err.println("Reload " + filename); reader.close(); File file = new File(filename); FileInputStream in = new FileInputStream(file); reader = new BufferedReader(new InputStreamReader(in)); }

Target:
public synchronized void reloadFile() { try (Reader r = reader) { System.err.println("Reload " + filename); reader = new BufferedReader(new FileReader(filename)); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public <A extends Annotation> ExpressionResult checkPermission(Class<A> annotationClass, PersistentResource resource, ChangeSpec changeSpec) { Supplier<Expression> expressionSupplier = () -> { if (SharePermission.class == annotationClass) { if (requestScope.getDictionary().isShareable(resource.getResourceClass())) { return expressionBuilder.buildAnyFieldExpressions(resource, ReadPermission.class, changeSpec); } else { ForbiddenAccessException e = new ForbiddenAccessException("Missing SharePermission for " + resource.getResourceClass().getName()); log.trace("{}", e.getLoggedMessage()); throw e; } } return expressionBuilder.buildAnyFieldExpressions(resource, annotationClass, changeSpec); }; Function<Expression, ExpressionResult> expressionExecutor = (expression) -> { if ((((RequestScope) resource.getRequestScope()).isMutatingMultipleEntities() || annotationClass == UpdatePermission.class) && requestScope.getNewPersistentResources().contains(resource)) { return executeUserChecksDeferInline(annotationClass, expression); } return executeExpressions(expression, annotationClass, Expression.EvaluationMode.INLINE_CHECKS_ONLY); }; return checkPermissions( resource.getResourceClass(), annotationClass, Optional.empty(), expressionSupplier, expressionExecutor); }

Target:
public <A extends Annotation> ExpressionResult checkPermission(Class<A> annotationClass, PersistentResource resource, ChangeSpec changeSpec) { Supplier<Expression> expressionSupplier = () -> { if (SharePermission.class == annotationClass) { if (requestScope.getDictionary().isShareable(resource.getResourceClass())) { return expressionBuilder.buildAnyFieldExpressions(resource, ReadPermission.class, changeSpec); } else { return expressionBuilder.FAIL_EXPRESSION; } } return expressionBuilder.buildAnyFieldExpressions(resource, annotationClass, changeSpec); }; Function<Expression, ExpressionResult> expressionExecutor = (expression) -> { if ((((RequestScope) resource.getRequestScope()).isMutatingMultipleEntities() || annotationClass == UpdatePermission.class) && requestScope.getNewPersistentResources().contains(resource)) { return executeUserChecksDeferInline(annotationClass, expression); } return executeExpressions(expression, annotationClass, Expression.EvaluationMode.INLINE_CHECKS_ONLY); }; return checkPermissions( resource.getResourceClass(), annotationClass, Optional.empty(), expressionSupplier, expressionExecutor); }
Source:
public Response diagnoseInstance( String applicationName, String instancePath ) { final Application application = this.manager.findApplicationByName( applicationName ); if (application == null) { return Response .status( Status.BAD_REQUEST ) .entity( "No application with name " + applicationName ) .build(); } final Instance instance = InstanceHelpers.findInstanceByPath( application, instancePath ); if (instance == null) { return Response .status( Status.BAD_REQUEST ) .entity( "No instance with path " + instancePath + " in application " + applicationName ) .build(); } return Response.status( Status.OK ).entity( instance ).build(); }

Target:
public Response diagnoseInstance( String applicationName, String instancePath ) { final Response response; final Application application = this.manager.findApplicationByName( applicationName ); if (application != null) { final Instance instance = InstanceHelpers.findInstanceByPath( application, instancePath ); if (instance != null) { response = Response.status( Status.OK ).entity( instance ).build(); } else { response = Response .status( Status.BAD_REQUEST ) .entity( "No instance with path " + instancePath + " in application " + applicationName ) .build(); } } else { response = Response .status( Status.BAD_REQUEST ) .entity( "No application with name " + applicationName ) .build(); } return response; }
Source:
public void testVisitPropertyIsGreaterThanOrEqualTo() throws Exception { getRootFilterNode("comparison-binary-ops", "PropertyIsGreaterThanOrEqualTo.xml") .accept(visitor); assertLeafNode(visitor.getResult(), ">=", "depth", "100"); }

Target:
public void testVisitPropertyIsGreaterThanOrEqualTo() throws Exception { getRootFilterNode("comparison-binary-ops", "PropertyIsGreaterThanOrEqualTo.xml") .accept(visitor); assertLeafNode(visitor.getResult(), ">=", DEPTH_PROP, DEPTH_VAL); }
Source:
private String parseDest() throws IOException, InvalidEdgeFormatException { StringBuilder dest = new StringBuilder(ID_LENGTH_GUESS); int point = eatSpaces(br.read()); boolean destParsed = false; char next; parseLoop: while (point != -1) { next = (char) point; switch (next) { case '\n': case '\r': break parseLoop; case ' ': destParsed = true; point = eatSpaces(br.read()); break; default: if (destParsed) { throw new InvalidEdgeFormatException("Found extra node"); } dest.append(next); point = br.read(); } } if (dest.length() == 0) { throw new InvalidEdgeFormatException("Missing destination node"); } return dest.toString(); }

Target:
private String parseDest() throws IOException, InvalidEdgeFormatException { StringBuilder dest = new StringBuilder(ID_LENGTH_GUESS); boolean destParsed = false; char next; while (currentChar != -1) { next = (char) currentChar; switch (next) { case '\n': case '\r': currentChar = -1; break; case ' ': destParsed = true; eatSpaces(); break; default: if (destParsed) { throw new InvalidEdgeFormatException("Found extra node"); } dest.append(next); currentChar = br.read(); } } if (dest.length() == 0) { throw new InvalidEdgeFormatException("Missing destination node"); } return dest.toString(); }
Source:
public static boolean canExecutePartially(List<? extends BusinessEntityWithStatus<?, ?>> entities, Class type, VdcActionType action) { if (_matrix.containsKey(type)) { for (BusinessEntityWithStatus<?, ?> a : entities) { if (a.getClass() == type && (!_matrix.get(type).containsKey(a.getStatus()) || !_matrix.get(type).get(a.getStatus()).contains(action))) { return true; } } } return false; }

Target:
public static boolean canExecutePartially(List<? extends BusinessEntityWithStatus<?, ?>> entities, Class type, VdcActionType action) { if (_matrix.containsKey(type)) { for (BusinessEntityWithStatus<?, ?> a : entities) { if (a.getClass() == type && (!_matrix.get(type).containsKey(a.getStatus()) || !_matrix.get(type).get(a.getStatus()).contains(action))) { return true; } } } else { return true; } return false; }
Source:
public void shutdown() throws InterruptedException { stopRebalancingTimer(); while (_eventThread.isAlive()) { _eventThread.interrupt(); _eventThread.join(1000); } }

Target:
public void shutdown() throws InterruptedException { stopRebalancingTimer(); while (_eventThread.isAlive()) { _eventThread.interrupt(); _eventThread.join(EVENT_THREAD_JOIN_TIMEOUT); } }
Source:
private void initInternalAPI() { if (this.internalAPI == null && this.internalAPIUrls != null) { for (String lookupURL : this.internalAPIUrls) { try { this.internalAPI = PAActiveObject.lookupActive(SynchronizationInternal.class, lookupURL); return; } catch (Exception e) { logger.warn("Could not lookup Synchronization service at " + lookupURL, e); } } throw new IllegalStateException("Could not locate the Synchronization service at " + Arrays.toString(internalAPIUrls)); } }

Target:
private synchronized void initInternalAPI() { if (this.internalAPI == null && this.internalAPIUrls != null) { for (String lookupURL : this.internalAPIUrls) { try { this.internalAPI = PAActiveObject.lookupActive(SynchronizationInternal.class, lookupURL); return; } catch (Exception e) { logger.warn("Could not lookup Synchronization service at " + lookupURL, e); } } throw new IllegalStateException("Could not locate the Synchronization service at " + Arrays.toString(internalAPIUrls)); } }
Source:
public void setUp() throws Exception { r.jenkins.getDescriptorByType(GlobalDefaultFlowDurabilityLevel.DescriptorImpl.class).setDurabilityHint(FlowDurabilityHint.PERFORMANCE_OPTIMIZED); deletePods(cloud.connect(), getLabels(cloud, this, name), false); assertNotNull(createJobThenScheduleRun()); UsernamePasswordCredentialsImpl creds = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "id", "some credentials", "username", "password"); SystemCredentialsProvider.getInstance().getCredentials().add(creds); }

Target:
public void setUp() throws Exception { deletePods(cloud.connect(), getLabels(cloud, this, name), false); assertNotNull(createJobThenScheduleRun()); UsernamePasswordCredentialsImpl creds = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "id", "some credentials", "username", "password"); SystemCredentialsProvider.getInstance().getCredentials().add(creds); }
Source:
public NotificationDto process(File runDirectory, TimeZone tz) throws Exception { Path runPath = runDirectory.toPath().toAbsolutePath(); ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JavaTimeModule()) .setDateFormat(new ISO8601DateFormat()); Process process = new ProcessBuilder("runscanner-illumina", runDirectory.getAbsolutePath()).directory(runDirectory).start(); IlluminaNotificationDto dto = mapper.readValue(process.getInputStream(), IlluminaNotificationDto.class); dto.setSequencerFolderPath(runPath); if (process.waitFor() != 0) { throw new IOException("Illumina run processor did not exit cleanly: " + runDirectory.getAbsolutePath()); } return dto; }

Target:
public NotificationDto process(File runDirectory, TimeZone tz) throws IOException { Path runPath = runDirectory.toPath().toAbsolutePath(); Process process = new ProcessBuilder("runscanner-illumina", runDirectory.getAbsolutePath()).directory(runDirectory).start(); IlluminaNotificationDto dto = createObjectMapper().readValue(process.getInputStream(), IlluminaNotificationDto.class); dto.setSequencerFolderPath(runPath); try { if (process.waitFor() != 0) { throw new IOException("Illumina run processor did not exit cleanly: " + runDirectory.getAbsolutePath()); } } catch (InterruptedException e) { throw new IOException(e); } File rtaLogDir = new File(runDirectory, "/Data/RTALogs"); boolean failed = rtaLogDir.exists() ? Arrays.stream(rtaLogDir.listFiles(file -> file.getName().endsWith("Log.txt") || file.getName().endsWith("Log_00.txt"))) .anyMatch(file -> { try (Scanner scanner = new Scanner(file)) { return scanner.findWithinHorizon(FAILED_MESSAGE, 0) != null; } catch (FileNotFoundException e) { log.error("RTA file vanished before reading", e); return false; } }) : false; if (failed) { dto.setHealthType(HealthType.Failed); } return dto; }
Source:
private void updateGuiding(final TargetEnvironment env) { toggleAgsGuiElements(); final Option<ObsContext> ctx = getObsContext(env); _w.guidingControls.update(ctx); final ISPObsComponent node = getContextTargetObsComp(); TargetSelection.getTargetForNode(env, node).foreach(target -> _w.detailEditor.gfe().edit(ctx, target, node)); }

Target:
private void updateGuiding(final TargetEnvironment env) { toggleAgsGuiElements(); final Option<ObsContext> ctx = getObsContext(env); _w.guidingControls.update(ctx); final ISPObsComponent node = getContextTargetObsComp(); TargetSelection.getTargetForNode(env, node).foreach(target -> _w.detailEditor.guidingFeedbackEditor().edit(ctx, target, node)); }
Source:
private static String getCertificateSHA1Fingerprint() { PackageManager pm = app.getPackageManager(); String packageName = app.getPackageName(); int flags = PackageManager.GET_SIGNATURES; PackageInfo packageInfo = null; try { packageInfo = pm.getPackageInfo(packageName, flags); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } Signature[] signatures = packageInfo.signatures; byte[] cert = signatures[0].toByteArray(); InputStream input = new ByteArrayInputStream(cert); CertificateFactory cf = null; try { cf = CertificateFactory.getInstance("X509"); } catch (CertificateException e) { e.printStackTrace(); } X509Certificate c = null; try { c = (X509Certificate) cf.generateCertificate(input); } catch (CertificateException e) { e.printStackTrace(); } String hexString = null; try { MessageDigest md = MessageDigest.getInstance("SHA1"); byte[] publicKey = md.digest(c.getEncoded()); hexString = byte2HexFormatted(publicKey); } catch (NoSuchAlgorithmException e1) { e1.printStackTrace(); } catch (CertificateEncodingException e) { e.printStackTrace(); } return hexString; }

Target:
private static String getCertificateSHA1Fingerprint() { PackageManager pm = app.getPackageManager(); String packageName = app.getPackageName(); int flags = PackageManager.GET_SIGNATURES; PackageInfo packageInfo = null; try { packageInfo = pm.getPackageInfo(packageName, flags); } catch (PackageManager.NameNotFoundException ex) { ErrorActivity.reportError(app, ex, null, null, ErrorActivity.ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", "Could not find package info", R.string.app_ui_crash)); } Signature[] signatures = packageInfo.signatures; byte[] cert = signatures[0].toByteArray(); InputStream input = new ByteArrayInputStream(cert); CertificateFactory cf = null; X509Certificate c = null; try { cf = CertificateFactory.getInstance("X509"); c = (X509Certificate) cf.generateCertificate(input); } catch (CertificateException ex) { ErrorActivity.reportError(app, ex, null, null, ErrorActivity.ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", "Certificate error", R.string.app_ui_crash)); } String hexString = null; try { MessageDigest md = MessageDigest.getInstance("SHA1"); byte[] publicKey = md.digest(c.getEncoded()); hexString = byte2HexFormatted(publicKey); } catch (NoSuchAlgorithmException ex1) { ErrorActivity.reportError(app, ex1, null, null, ErrorActivity.ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", "Could not retrieve SHA1 key", R.string.app_ui_crash)); } catch (CertificateEncodingException ex2) { ErrorActivity.reportError(app, ex2, null, null, ErrorActivity.ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", "Could not retrieve SHA1 key", R.string.app_ui_crash)); } return hexString; }
Source:
public static AbstractMap.SimpleImmutableEntry<String, Object> pair(String key, Object value) { return new AbstractMap.SimpleImmutableEntry<>(key, value); }

Target:
public static Map.Entry<String, Object> pair(String key, Object value) { return new AbstractMap.SimpleImmutableEntry<>(key, value); }
Source:
protected void endSuccessfully() { try { if (getParameters().isHotPlugLease() && !runVdsCommand(VDSCommandType.HotPlugLease, new LeaseVDSParameters(getParameters().getVdsId(), getParameters().getVmId(), getParameters().getStorageDomainId())).getSucceeded()) { setVmId(getParameters().getVmId()); auditLog(this, AuditLogType.HOT_PLUG_LEASE_FAILED); setSucceeded(false); return; } } catch (EngineException e) { log.error("Failure in hot plugging a lease to VM {}, message: {}", getParameters().getVmId(), e.getMessage()); auditLog(this, AuditLogType.HOT_PLUG_LEASE_FAILED); return; } setSucceeded(true); }

Target:
protected void endSuccessfully() { if (getParameters().isHotPlugLease()) { boolean hotPlugSucceeded = false; try { hotPlugSucceeded = runVdsCommand(VDSCommandType.HotPlugLease, new LeaseVDSParameters(getParameters().getVdsId(), getParameters().getVmId(), getParameters().getStorageDomainId())).getSucceeded(); } catch (EngineException e) { log.error("Failure in hot plugging a lease to VM {}, message: {}", getParameters().getVmId(), e.getMessage()); } if (!hotPlugSucceeded) { auditLog(this, AuditLogType.HOT_PLUG_LEASE_FAILED); setSucceeded(false); return; } } setSucceeded(true); }
Source:
public synchronized void tryInitialize() { if (isInitialized()) { log.warn("Tried to initialize Transaction Managers, but was already initialized"); return; } TransactionTables.createTables(keyValueService); Set<Schema> allSchemas = ImmutableSet.<Schema>builder() .add(SweepSchema.INSTANCE.getLatestSchema()) .addAll(schemas) .build(); for (Schema schema : allSchemas) { Schemas.createTablesAndIndexes(schema, keyValueService); } LoggingArgs.hydrate(keyValueService.getMetadataForTables()); isInitialized = true; }

Target:
public synchronized void tryInitialize() { assertNotInitialized(); TransactionTables.createTables(keyValueService); Set<Schema> allSchemas = ImmutableSet.<Schema>builder() .add(SweepSchema.INSTANCE.getLatestSchema()) .addAll(schemas) .build(); for (Schema schema : allSchemas) { Schemas.createTablesAndIndexes(schema, keyValueService); } LoggingArgs.hydrate(keyValueService.getMetadataForTables()); isInitialized = true; }
Source:
public boolean waitForChange(int timeoutMs) throws InterruptedException { int count = registeredPathsCount; if (count == 0) { throw new IllegalStateException(); } long limit = SystemTime.getInstance().milliseconds() + timeoutMs; while (true) { final WatchKey wk = watchService.poll(limit - SystemTime.getInstance().milliseconds(), TimeUnit.MILLISECONDS); if (wk == null) { System.out.println("Timed out waiting for file changes, count: " + count); return false; } if (!keys.containsKey(wk)) { throw new IllegalStateException("Unexpected event received"); } for (WatchEvent<?> event : wk.pollEvents()) { final Path changed = (Path) event.context(); System.out.println(changed); System.out.println("dir: " + keys.get(wk)); if (changed.endsWith(fileName)) { count--; break; } } wk.reset(); keys.remove(wk); if (count == 0) { break; } } return true; }

Target:
public boolean waitForChange(int timeoutMs) throws InterruptedException { int count = registeredPathsCount; if (count == 0) { throw new IllegalStateException(); } long limit = SystemTime.getInstance().milliseconds() + timeoutMs; while (true) { final WatchKey wk = watchService.poll(limit - SystemTime.getInstance().milliseconds(), TimeUnit.MILLISECONDS); if (wk == null) { return false; } if (!keys.containsKey(wk)) { throw new IllegalStateException("Unexpected event received"); } for (WatchEvent<?> event : wk.pollEvents()) { final Path changed = (Path) event.context(); if (changed.endsWith(fileName)) { count--; break; } } wk.reset(); keys.remove(wk); if (count == 0) { break; } } return true; }
Source:
public List<RadiologyOrder> getRadiologyOrders(RadiologyOrderSearchCriteria searchCriteria) { final Criteria crit = sessionFactory.getCurrentSession() .createCriteria(RadiologyOrder.class); if (searchCriteria.getPatient() != null) { crit.add(Restrictions.eq("patient", searchCriteria.getPatient())); } if (!searchCriteria.getIncludeVoided()) { crit.add(Restrictions.not(Restrictions.eq("voided", true))); } if (searchCriteria.getUrgency() != null) { crit.add(Restrictions.eq("urgency", searchCriteria.getUrgency())); } if (searchCriteria.getFromEffectiveStartDate() != null) { Disjunction disjunction = Restrictions.disjunction(); disjunction.add(Restrictions.and((Restrictions.eq("urgency", Urgency.ON_SCHEDULED_DATE)), Restrictions.ge("scheduledDate", searchCriteria.getFromEffectiveStartDate()))); disjunction.add(Restrictions.and(Restrictions.not((Restrictions.eq("urgency", Urgency.ON_SCHEDULED_DATE))), Restrictions.ge("dateActivated", searchCriteria.getFromEffectiveStartDate()))); crit.add(disjunction); } if (searchCriteria.getToEffectiveStartDate() != null) { Disjunction disjunction = Restrictions.disjunction(); disjunction.add(Restrictions.and((Restrictions.eq("urgency", Urgency.ON_SCHEDULED_DATE)), Restrictions.le("scheduledDate", searchCriteria.getToEffectiveStartDate()))); disjunction.add(Restrictions.and(Restrictions.not((Restrictions.eq("urgency", Urgency.ON_SCHEDULED_DATE))), Restrictions.le("dateActivated", searchCriteria.getToEffectiveStartDate()))); crit.add(disjunction); } return crit.list(); }

Target:
public List<RadiologyOrder> getRadiologyOrders(RadiologyOrderSearchCriteria searchCriteria) { final Criteria crit = sessionFactory.getCurrentSession() .createCriteria(RadiologyOrder.class); if (searchCriteria.getPatient() != null) { crit.add(Restrictions.eq("patient", searchCriteria.getPatient())); } if (!searchCriteria.getIncludeVoided()) { crit.add(Restrictions.not(Restrictions.eq("voided", true))); } if (searchCriteria.getUrgency() != null) { crit.add(Restrictions.eq("urgency", searchCriteria.getUrgency())); } if (searchCriteria.getFromEffectiveStartDate() != null) { final Disjunction disjunction = Restrictions.disjunction(); disjunction.add(Restrictions.conjunction() .add(Restrictions.eq("urgency", Urgency.ON_SCHEDULED_DATE)) .add(Restrictions.ge("scheduledDate", searchCriteria.getFromEffectiveStartDate()))); disjunction.add(Restrictions.conjunction() .add(Restrictions.not(Restrictions.eq("urgency", Urgency.ON_SCHEDULED_DATE))) .add(Restrictions.ge("dateActivated", searchCriteria.getFromEffectiveStartDate()))); crit.add(disjunction); } if (searchCriteria.getToEffectiveStartDate() != null) { final Disjunction disjunction = Restrictions.disjunction(); disjunction.add(Restrictions.conjunction() .add(Restrictions.eq("urgency", Urgency.ON_SCHEDULED_DATE)) .add(Restrictions.le("scheduledDate", searchCriteria.getToEffectiveStartDate()))); disjunction.add(Restrictions.conjunction() .add(Restrictions.not((Restrictions.eq("urgency", Urgency.ON_SCHEDULED_DATE)))) .add(Restrictions.le("dateActivated", searchCriteria.getToEffectiveStartDate()))); crit.add(disjunction); } return crit.list(); }
Source:
public static void migrateAppWideMobileEditorPreferenceToRemote(final AccountStore accountStore, final SiteStore siteStore, final Dispatcher dispatcher) { if (AppPrefs.isUserInGutenbergRolloutGroup()) { return; } if (accountStore.getAccount().getUserId() % 100 >= (100 - GB_ROLLOUT_PERCENTAGE)) { for (SiteModel site : siteStore.getSites()) { if (TextUtils.isEmpty(site.getMobileEditor())) { enableBlockEditor(dispatcher, site); AnalyticsUtils.trackWithSiteDetails(Stat.EDITOR_GUTENBERG_ENABLED, site, BlockEditorEnabledSource.ON_PROGRESSIVE_ROLLOUT.asPropertyMap()); AppPrefs.setShowGutenbergInfoPopupForTheNewPosts(site.getUrl(), true); } } AppPrefs.setUserInGutenbergRolloutGroup(); } if (!AppPrefs.isDefaultAppWideEditorPreferenceSet()) { return; } final boolean oldAppWidePreferenceValue = AppPrefs.isGutenbergDefaultForNewPosts(); if (oldAppWidePreferenceValue) { dispatcher.dispatch(SiteActionBuilder.newDesignateMobileEditorForAllSitesAction( new DesignateMobileEditorForAllSitesPayload(SiteUtils.GB_EDITOR_NAME))); } else { dispatcher.dispatch(SiteActionBuilder.newDesignateMobileEditorForAllSitesAction( new DesignateMobileEditorForAllSitesPayload(SiteUtils.AZTEC_EDITOR_NAME))); } }

Target:
public static void migrateAppWideMobileEditorPreferenceToRemote(final AccountStore accountStore, final SiteStore siteStore, final Dispatcher dispatcher) { if (!FluxCUtils.isSignedInWPComOrHasWPOrgSite(accountStore, siteStore)) { return; } if (AppPrefs.isUserInGutenbergRolloutGroup()) { return; } if (accountStore.getAccount().getUserId() % 100 >= (100 - GB_ROLLOUT_PERCENTAGE)) { if (atLeastOneSiteHasAztecEnabled(siteStore)) { return; } if (!NetworkUtils.isNetworkAvailable(WordPress.getContext())) { return; } for (SiteModel site : siteStore.getSites()) { if (TextUtils.isEmpty(site.getMobileEditor())) { AppPrefs.setShowGutenbergInfoPopupForTheNewPosts(site.getUrl(), true); } } dispatcher.dispatch(SiteActionBuilder.newDesignateMobileEditorForAllSitesAction( new DesignateMobileEditorForAllSitesPayload(SiteUtils.GB_EDITOR_NAME))); AppPrefs.setUserInGutenbergRolloutGroup(); } if (!AppPrefs.isDefaultAppWideEditorPreferenceSet()) { return; } final boolean oldAppWidePreferenceValue = AppPrefs.isGutenbergDefaultForNewPosts(); if (oldAppWidePreferenceValue) { dispatcher.dispatch(SiteActionBuilder.newDesignateMobileEditorForAllSitesAction( new DesignateMobileEditorForAllSitesPayload(SiteUtils.GB_EDITOR_NAME))); } else { dispatcher.dispatch(SiteActionBuilder.newDesignateMobileEditorForAllSitesAction( new DesignateMobileEditorForAllSitesPayload(SiteUtils.AZTEC_EDITOR_NAME))); } }
Source:
public boolean isPage200(HttpMessage msg) { return parent.isPage200(msg); }

Target:
protected boolean isPage200(HttpMessage msg) { return isCustomPage(msg, CustomPage.Type.OK_200); }
Source:
public AnnotationVisitor visitLocalVariableAnnotation(final int typeRef, final TypePath typePath, final Label[] start, final Label[] end, final int[] index, final String descriptor, final boolean visible) { int[] newIndex = new int[index.length]; for (int i = 0; i < newIndex.length; i++) { newIndex[i] = map(index[i]); } return mv.visitLocalVariableAnnotation(typeRef, typePath, start, end, newIndex, descriptor, visible); }

Target:
public AnnotationVisitor visitLocalVariableAnnotation(final int typeRef, final TypePath typePath, final Label[] start, final Label[] end, final int[] index, final String descriptor, final boolean visible) { final int[] newIndex = new int[index.length]; for (int i = 0; i < newIndex.length; i++) { newIndex[i] = map(index[i]); } return mv.visitLocalVariableAnnotation(typeRef, typePath, start, end, newIndex, descriptor, visible); }
Source:
private void logSSLInfo(ChannelHandlerContext ctx) { if (sslLogMessage == null) { sslLogMessage = new StringBuilder(); sslLogMessage.append("SSL ("); try { SslHandler sslHandler = ctx.pipeline().get(SslHandler.class); boolean sslUsed = sslHandler != null; sslLogMessage.append("[used=").append(sslUsed).append("]"); if (sslUsed && publicAccessLogger.isCertLoggingEnabled()) { X509Certificate certificate = (X509Certificate) sslHandler.engine().getSession().getPeerCertificates()[0]; X500Principal principal = certificate.getSubjectX500Principal(); Collection subjectAlternativeNames = certificate.getSubjectAlternativeNames(); sslLogMessage.append(", [principal=").append(principal).append("]"); sslLogMessage.append(", [san=").append(subjectAlternativeNames).append("]"); } } catch (Exception e) { logger.error("Unexpected error while getting SSL connection info for public access logger", e); } sslLogMessage.append(")"); } logMessage.append(sslLogMessage); }

Target:
private void logSSLInfo(ChannelHandlerContext ctx) { if (sslLogMessage == null) { sslLogMessage = new StringBuilder(); sslLogMessage.append("SSL ("); try { SslHandler sslHandler = ctx.pipeline().get(SslHandler.class); boolean sslUsed = sslHandler != null; sslLogMessage.append("[used=").append(sslUsed).append("]"); if (sslUsed) { X509Certificate certificate = (X509Certificate) sslHandler.engine().getSession().getPeerCertificates()[0]; X500Principal principal = certificate.getSubjectX500Principal(); Collection subjectAlternativeNames = certificate.getSubjectAlternativeNames(); sslLogMessage.append(", [principal=").append(principal).append("]"); sslLogMessage.append(", [san=").append(subjectAlternativeNames).append("]"); } } catch (Exception e) { logger.error("Unexpected error while getting SSL connection info for public access logger", e); } sslLogMessage.append(")"); } logMessage.append(sslLogMessage); }
Source:
private String getSQLQuery(){ StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("SELECT max(obs.person_id) as PersonId, max(person.uuid) as PersonUuid, "); stringBuilder.append("(select identifier from patient_identifier where patient_id = max(encounter.patient_id) limit 0,1) as 'OpenMRS ID', "); stringBuilder.append("CONCAT(max(person_name.given_name),' ', max(person_name.middle_name), ' ', max(person_name.family_name)) as 'Patient Name', "); stringBuilder.append("IF(max(person.gender)='M', 'Male', 'Female') as Gender, "); stringBuilder.append("max(encounter.encounter_datetime) as 'Encounter Date', count(*) as 'Total Encounters' "); stringBuilder.append("FROM obs obs INNER JOIN concept_name cn ON obs.value_coded= cn.concept_id "); stringBuilder.append("INNER JOIN encounter encounter ON encounter.encounter_id = obs.encounter_id "); stringBuilder.append("INNER JOIN person person ON person.person_id = obs.person_id "); stringBuilder.append("INNER JOIN person_name person_name on person.person_id = person_name.person_id "); stringBuilder.append("WHERE cn.locale='en' "); stringBuilder.append("AND cn.locale_preferred = '1' "); stringBuilder.append("AND cn.uuid = :diagnosisUuid "); stringBuilder.append("AND obs.date_created >= :startDate "); stringBuilder.append("AND obs.date_created <= :endDate "); stringBuilder.append("group by person.uuid "); stringBuilder.append("order by count(*) DESC limit 0,30;"); return stringBuilder.toString(); }

Target:
private String getSQLQuery(){ StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("SELECT max(obs.person_id) as PersonId, max(person.uuid) as PersonUuid, "); stringBuilder.append("(select identifier from patient_identifier where patient_id = max(encounter.patient_id) and preferred=true limit 0,1) as 'OpenMRS ID', "); stringBuilder.append("CONCAT(max(person_name.given_name),' ', max(person_name.middle_name), ' ', max(person_name.family_name)) as 'Patient Name', "); stringBuilder.append("IF(max(person.gender)='M', 'Male', 'Female') as Gender, "); stringBuilder.append("max(encounter.encounter_datetime) as 'Encounter Date', count(*) as 'Total Encounters' "); stringBuilder.append("FROM obs obs INNER JOIN concept_name cn ON obs.value_coded= cn.concept_id "); stringBuilder.append("INNER JOIN encounter encounter ON encounter.encounter_id = obs.encounter_id "); stringBuilder.append("INNER JOIN person person ON person.person_id = obs.person_id "); stringBuilder.append("INNER JOIN person_name person_name on person.person_id = person_name.person_id "); stringBuilder.append("WHERE cn.locale='en' "); stringBuilder.append("AND cn.locale_preferred = '1' "); stringBuilder.append("AND cn.uuid = :diagnosisUuid "); stringBuilder.append("AND obs.date_created >= :startDate "); stringBuilder.append("AND obs.date_created <= :endDate "); stringBuilder.append("group by person.uuid "); stringBuilder.append("order by count(*) DESC limit 0,30;"); return stringBuilder.toString(); }
Source:
public ChatScriptEndpoint(String uri, String remaining, ChatScriptComponent component) throws URISyntaxException { super(uri, component); URI remainingUri = new URI("tcp://" + remaining); port = remainingUri.getPort() == -1 ? DEFAULT_PORT : remainingUri.getPort(); if (ObjectHelper.isEmpty(remainingUri.getPath())) { throw new IllegalArgumentException(URI_ERROR); } host = remainingUri.getHost(); if (ObjectHelper.isEmpty(host)) { throw new IllegalArgumentException(URI_ERROR); } botname = remainingUri.getPath(); if (ObjectHelper.isEmpty(botname)) { throw new IllegalArgumentException(URI_ERROR); } botname = botname.substring(1); setBot(new ChatScriptBot(getHostName(), getPort(), getBotName(), "")); }

Target:
public ChatScriptEndpoint(String uri, String remaining, ChatScriptComponent component) throws URISyntaxException { super(uri, component); URI remainingUri = new URI("tcp://" + remaining); port = remainingUri.getPort() == -1 ? DEFAULT_PORT : remainingUri.getPort(); if (ObjectHelper.isEmpty(remainingUri.getPath())) { throw new IllegalArgumentException(ChatScriptConstants.URI_ERROR); } host = remainingUri.getHost(); if (ObjectHelper.isEmpty(host)) { throw new IllegalArgumentException(ChatScriptConstants.URI_ERROR); } botName = remainingUri.getPath(); if (ObjectHelper.isEmpty(botName)) { throw new IllegalArgumentException(ChatScriptConstants.URI_ERROR); } botName = botName.substring(1); setBot(new ChatScriptBot(getHost(), getPort(), getBotName(), "")); }
Source:
public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> parameterValues, PatientCalculationContext context) { Program mchmsProgram = MetadataUtils.getProgram(Metadata.Program.MCHMS); Set<Integer> alive = alivePatients(cohort, context); Set<Integer> inMchmsProgram = CalculationUtils.patientsThatPass(Calculations.activeEnrollment(mchmsProgram, alive, context)); CalculationResultMap lastHivStatusObss = Calculations.lastObs(getConcept(Dictionary.HIV_STATUS), inMchmsProgram, context); CalculationResultMap ret = new CalculationResultMap(); boolean notHivTested; for (Integer ptId : cohort) { notHivTested = false; if (inMchmsProgram.contains(ptId)) { Concept lastHivStatus = EmrCalculationUtils.codedObsResultForPatient(lastHivStatusObss, ptId); if (lastHivStatus != null) { notHivTested = lastHivStatus.equals(Dictionary.getConcept(Dictionary.NOT_HIV_TESTED)); } } ret.put(ptId, new BooleanResult(notHivTested, this, context)); } return ret; }

Target:
public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> parameterValues, PatientCalculationContext context) { Program mchmsProgram = MetadataUtils.getProgram(Metadata.Program.MCHMS); Set<Integer> alive = alivePatients(cohort, context); Set<Integer> inMchmsProgram = CalculationUtils.patientsThatPass(Calculations.activeEnrollment(mchmsProgram, alive, context)); CalculationResultMap lastHivStatusObss = Calculations.lastObs(getConcept(Dictionary.HIV_STATUS), inMchmsProgram, context); CalculationResultMap ret = new CalculationResultMap(); for (Integer ptId : cohort) { boolean notHivTested = false; if (inMchmsProgram.contains(ptId)) { Concept lastHivStatus = EmrCalculationUtils.codedObsResultForPatient(lastHivStatusObss, ptId); if (lastHivStatus != null) { notHivTested = lastHivStatus.equals(Dictionary.getConcept(Dictionary.NOT_HIV_TESTED)); } } ret.put(ptId, new BooleanResult(notHivTested, this, context)); } return ret; }
Source:
protected boolean updateBrickServerName(GlusterBrickEntity brick, boolean addCanDoActionMessage) { VdsStatic server = getVdsStaticDao().get(brick.getServerId()); if ((server == null || !server.getvds_group_id().equals(getVdsGroupId())) && addCanDoActionMessage) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_BRICK_SERVER_ID); return false; } brick.setServerName(server.gethost_name()); return true; }

Target:
protected boolean updateBrickServerName(GlusterBrickEntity brick, boolean addCanDoActionMessage) { VdsStatic server = getVdsStaticDao().get(brick.getServerId()); if ((server == null || !server.getvds_group_id().equals(getVdsGroupId()))) { if (addCanDoActionMessage) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_BRICK_SERVER_ID); } return false; } brick.setServerName(server.gethost_name()); return true; }
Source:
public DatastreamPositionResponse getPositionResponse() { DatastreamPositionResponse response = new DatastreamPositionResponse(); PhysicalSources positions = _kafkaPositionTrackerTask.getPositions(); Map<String, PhysicalSources> datastreamsToPhysicalSources = _datastreamTask.getDatastreams() .stream() .map(Datastream::getName) .collect(Collectors.toMap(name -> name, name -> positions)); response.setDatastreamToPhysicalSources(datastreamsToPhysicalSources); return response; }

Target:
public DatastreamPositionResponse getPositionResponse() { return new DatastreamPositionResponse(ImmutableMap.of(_datastreamName, _kafkaPositionTracker.getPositions())); }
Source:
public <E extends Enum<E>> StructArrayEncoder enm(String name, E value) { EnmField<E> field = (EnmField<E>) fieldSearcher.findField(name, EnmField.class, null); currentData.add(new EnmDataHolder<E>(value, field.index(), field.getEnm())); return this; }

Target:
public <E> StructArrayEncoder enm(String name, E value) { EnumField<E> field = (EnumField<E>) fieldSearcher.findField(name, EnumField.class, null); currentData.add(new EnumDataHolder<E>(value, field.index(), field.getEnumMapping())); return this; }
Source:
public Response createNewGatewayAccount(JsonNode node, @Context UriInfo uriInfo) { logger.error("Testing logging"); if (!node.has(ACCOUNT_NAME)) { return ResponseUtil.badResponse("Missing fields: name"); } String name = node.get("name").textValue(); logger.info("Creating new gateway account called {}", name); Long accountId = gatewayDao.insertNameAndReturnNewId(name); URI newLocation = uriInfo. getBaseUriBuilder(). path("/api/gateway/{accountId}").build(accountId); Map<String, Object> account = Maps.newHashMap(); account.put("account_id", "" + accountId); addSelfLink(newLocation, account); return Response.created(newLocation).entity(account).build(); }

Target:
public Response createNewGatewayAccount(JsonNode node, @Context UriInfo uriInfo) { logger.error("Testing logging"); if (!node.has(ACCOUNT_NAME)) { return ResponseUtil.badResponse("Missing fields: name"); } String name = node.get(ACCOUNT_NAME).textValue(); logger.info("Creating new gateway account called {}", name); Long accountId = gatewayDao.insertNameAndReturnNewId(name); URI newLocation = uriInfo. getBaseUriBuilder(). path("/api/gateway/{accountId}").build(accountId); Map<String, Object> account = Maps.newHashMap(); account.put("account_id", "" + accountId); addSelfLink(newLocation, account); return Response.created(newLocation).entity(account).build(); }
Source:
public void enter() { logD("Enter Disconnected"); if (mMostRecentState != BluetoothProfile.STATE_DISCONNECTED) { sendMessage(CLEANUP); } onConnectionStateChanged(BluetoothProfile.STATE_DISCONNECTED); }

Target:
public void enter() { logD("Enter Disconnected"); if (mMostRecentState != BluetoothProfile.STATE_DISCONNECTED) { sendMessage(CLEANUP); } broadcastConnectionStateChanged(BluetoothProfile.STATE_DISCONNECTED); }