auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void unexpectedEOFs() { try { Parser.parse("a:."); fail("Inputs which end unexpectedly should throw a parse exception"); } catch (ParseException ignored) try { Parser.parse("a:"); fail("Inputs which end unexpectedly should throw a parse exception"); } catch (ParseException ignored) try { Parser.parse("~"); fail("Inputs which end unexpectedly should throw a parse exception"); } catch (ParseException ignored) try { Parser.parse("a(b) ||"); fail("Inputs which end unexpectedly should throw a parse exception"); } catch (ParseException ignored) try { Parser.parse("a:b; c:d;e"); fail("Inputs which end unexpectedly should throw a parse exception"); } catch (ParseException ignored) }

Target:
public void unexpectedEOFs() { try { Parser.parse("a:."); fail("Inputs which end unexpectedly should throw a parse exception"); } catch (ParseException ignored) try { Parser.parse("a:"); fail("Inputs which end unexpectedly should throw a parse exception"); } catch (ParseException ignored) try { Parser.parse("~"); fail("Inputs which end unexpectedly should throw a parse exception"); } catch (ParseException ignored) try { Parser.parse("a(b) ||"); fail("Inputs which end unexpectedly should throw a parse exception"); } catch (ParseException ignored) }
Source:
public void jobsUpdated(Map<Integer, Job> jobs) { ArrayList selectedJobsIds = this.controller.getModel().getSelectedJobsIds(); RecordList data = new RecordList(); for (Job j : jobs.values()) { JobRecord jobRecord = new JobRecord(j); this.columnsFactory.buildRecord(j, jobRecord); data.add(jobRecord); if (selectedJobsIds != null && selectedJobsIds.contains(j.getId())) { jobRecord.setAttribute("isSelected", true); } } this.ds.setTestData(data.toArray()); applyCurrentLocalFilter(); }

Target:
public void jobsUpdated(Map<Integer, Job> jobs) { List<Integer> selectedJobsIds = this.controller.getModel().getSelectedJobsIds(); RecordList data = new RecordList(); for (Job j : jobs.values()) { JobRecord jobRecord = new JobRecord(j); this.columnsFactory.buildRecord(j, jobRecord); data.add(jobRecord); if (selectedJobsIds != null && selectedJobsIds.contains(j.getId())) { jobRecord.setAttribute("isSelected", true); } } this.ds.setTestData(data.toArray()); applyCurrentLocalFilter(); }
Source:
private SpELContext(PropertyAccessor accessor, @Nullable SpelExpressionParser parser, @Nullable BeanFactory factory) { this.parser = parser == null ? new SpelExpressionParser() : parser; this.accessor = accessor; this.factory = factory; }

Target:
private SpELContext(PropertyAccessor accessor, @Nullable SpelExpressionParser parser, @Nullable BeanFactory factory) { Assert.notNull(accessor, "PropertyAccessor must not be null!"); this.parser = parser == null ? new SpelExpressionParser() : parser; this.accessor = accessor; this.factory = factory; }
Source:
public Double getValue() { double aggregatedValue = 0.0D; final Iterator<MetricsGauge> iterator = gauges.iterator(); while (iterator.hasNext()) { final MetricsGauge gauge = iterator.next(); if (gauge.hasExpired()) { iterator.remove(); } else { final double gaugeVal = gauge.value(); if (Double.isFinite(gaugeVal)) aggregatedValue += gaugeVal; } } return aggregatedValue; }

Target:
public Double getValue() { double aggregatedValue = Double.NaN; final Iterator<MetricsGauge> iterator = gauges.iterator(); while (iterator.hasNext()) { final MetricsGauge gauge = iterator.next(); if (gauge.hasExpired()) { iterator.remove(); } else { final double gaugeVal = gauge.value(); if (!Double.isNaN(gaugeVal)) aggregatedValue = (Double.isNaN(aggregatedValue) ? 0 : aggregatedValue) + gaugeVal; } } return aggregatedValue; }
Source:
private Diagram doTransformation(final String xml) { final String defSetId = getDefinitionSetId(dmnBackendService); final Metadata metadata = buildMetadataInstance(defSetId); final InputStream is = new ByteArrayInputStream(xml.getBytes()); try { final DMNMarshallerStandalone dmnMarshaller = (DMNMarshallerStandalone) dmnBackendService.getDiagramMarshaller(); final Graph<DefinitionSet, ?> graph = dmnMarshaller.unmarshall(metadata, is); final Node<Definition<DMNDiagram>, ?> diagramNode = GraphUtils.getFirstNode((Graph<?, Node>) graph, DMNDiagram.class); final String title = diagramNode.getContent().getDefinition().getDefinitions().getName().getValue(); metadata.setTitle(title); return dmnDiagramFactory.build(title, metadata, graph); } catch (Exception e) { LOG.error("Error whilst converting XML to DMNDiagram.", e); throw new DiagramParsingException(metadata, xml); } }

Target:
private Diagram doTransformation(final String xml) { final String defSetId = getDefinitionSetId(dmnBackendService); final Metadata metadata = buildMetadataInstance(defSetId); try (final InputStream is = new ByteArrayInputStream(xml.getBytes())) { final DMNMarshallerStandalone dmnMarshaller = (DMNMarshallerStandalone) dmnBackendService.getDiagramMarshaller(); final Graph<DefinitionSet, ?> graph = dmnMarshaller.unmarshall(metadata, is); final Node<Definition<DMNDiagram>, ?> diagramNode = GraphUtils.getFirstNode((Graph<?, Node>) graph, DMNDiagram.class); final String title = diagramNode.getContent().getDefinition().getDefinitions().getName().getValue(); metadata.setTitle(title); return dmnDiagramFactory.build(title, metadata, graph); } catch (Exception e) { LOG.error("Error whilst converting XML to DMNDiagram.", e); throw new DiagramParsingException(metadata, xml); } }
Source:
public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(ESM.ACTION_AWARE_ESM_QUEUE_COMPLETE)) { Log.d("NIELS", "Complete intent caught!"); getContentResolver().delete(ESM_Data.CONTENT_URI, ESM_Data.TRIGGER + " LIKE 'TRIAL'", null); } if (intent.getAction().equals(ESM.ACTION_AWARE_ESM_TIMEOUT)) { Log.d("NIELS", "Dropped intent caught!"); getContentResolver().delete(ESM_Data.CONTENT_URI, ESM_Data.TRIGGER + " LIKE 'TRIAL'", null); } finish(); }

Target:
public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(ESM.ACTION_AWARE_ESM_QUEUE_COMPLETE)) { getContentResolver().delete(ESM_Data.CONTENT_URI, ESM_Data.TRIGGER + " LIKE 'TRIAL'", null); } finish(); }
Source:
public static IncrementalIndex createIndex( AggregatorFactory[] aggregatorFactories, DimensionsSpec dimensionsSpec ) { if (null == aggregatorFactories) { aggregatorFactories = DEAFAULT_AGGREGATOR_FACTORIES; } return new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withDimensionsSpec(dimensionsSpec) .withMetrics(aggregatorFactories) .build() ) .setMaxRowCount(1000000) .buildOnheap(); }

Target:
public static IncrementalIndex createIndex( AggregatorFactory[] aggregatorFactories, DimensionsSpec dimensionsSpec ) { if (null == aggregatorFactories) { aggregatorFactories = DEFAULT_AGGREGATOR_FACTORIES; } return new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withDimensionsSpec(dimensionsSpec) .withMetrics(aggregatorFactories) .build() ) .setMaxRowCount(1000000) .buildOnheap(); }
Source:
public void complete(LineReader reader, ParsedLine line, List<Candidate> candidates) { List<String> completions = null; try { completions = server.getScheduler().syncIfNeeded(() -> server.getCommandMap() .tabComplete(sender, line.line())); } catch (Exception e) { LocalizedStrings.Console.Error.Manager.TAB_COMPLETE.log(e); } if (completions != null) { completions.forEach(completion -> candidates.add(new Candidate(completion))); } }

Target:
public void complete(LineReader reader, ParsedLine line, List<Candidate> candidates) { List<String> completions = null; try { completions = server.getScheduler().syncIfNeeded( () -> server.getCommandMap().tabComplete(sender, line.line())); } catch (Exception e) { ConsoleMessages.Warn.Manager.TAB_COMPLETE.log(e); } if (completions != null) { completions.forEach(completion -> candidates.add(new Candidate(completion))); } }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash_screen); WebView wv = (WebView) findViewById(R.id.splash_webview); wv.loadUrl("file:/ final Deferred<Bundle, Throwable, Integer> deferred = new DeferredObject<Bundle, Throwable, Integer>(); final Promise<Bundle, Throwable, Integer> promise = deferred.promise(); App.getLoginManager().autoLogin(new Callback() { @Override public boolean handleMessage(final Message msg) { deferred.resolve(msg.getData()); return true; } }); Handler splashHandler = new Handler() { @Override public void handleMessage(Message msg) { promise.done(new DoneCallback<Bundle>() { @Override public void onDone(Bundle args) { if (args != null && args.getBoolean(RestHandler.SUCCESS_KEY)) { redirect(App.hasInstanceCode()); } else { redirect(App.hasSkinCode()); } } }); } }; splashHandler.sendMessageDelayed(Message.obtain(), SPLASH_SCREEN_DELAY_MILIS); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash_screen); WebView wv = (WebView) findViewById(R.id.splash_webview); wv.loadUrl("file:/ final Deferred<Bundle, Throwable, Integer> deferred = new DeferredObject<Bundle, Throwable, Integer>(); final Promise<Bundle, Throwable, Integer> promise = deferred.promise(); App.getLoginManager().autoLogin(new Callback() { @Override public boolean handleMessage(final Message msg) { deferred.resolve(msg.getData()); return true; } }); Handler splashHandler = new Handler() { @Override public void handleMessage(Message msg) { promise.done(new DoneCallback<Bundle>() { @Override public void onDone(Bundle args) { if (args != null && args.getBoolean(RestHandler.SUCCESS_KEY)) { redirect(App.hasInstanceCode()); } else { redirect(App.hasSkinCode()); } } }); } }; splashHandler.sendMessageDelayed(Message.obtain(), SPLASH_SCREEN_DELAY_MILLIS); }
Source:
private Schema applyRegexReplaceRule(Schema inputSchema, RegexReplaceRule rule) { final String match = rule.getMatch(); final String replace = rule.getReplace(); Schema.Builder builder = Schema.builder(); for (Column column : inputSchema.getColumns()) { builder.add(column.getName().replaceAll(match, replace), column.getType()); } return builder.build(); }

Target:
private Schema applyRegexReplaceRule(Schema inputSchema, RegexReplaceRule rule) { final String match = rule.getMatch(); final String replace = rule.getReplace(); Schema.Builder builder = Schema.builder(); for (Column column : inputSchema.getColumns()) { try { builder.add(column.getName().replaceAll(match, replace), column.getType()); } catch (PatternSyntaxException ex) { throw new ConfigException(ex); } } return builder.build(); }
Source:
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { BigDecimal totalWorth = BigDecimal.ZERO; String type = ""; if (args.length < 1) { throw new NotEnoughArgumentsException(); } if (args[0].equalsIgnoreCase("hand") && !user.isAuthorized("essentials.sell.hand")) { throw new Exception(tl("sellHandPermission")); } else if ((args[0].equalsIgnoreCase("inventory") || args[0].equalsIgnoreCase("invent") || args[0].equalsIgnoreCase("all")) && !user.isAuthorized("essentials.sell.bulk")) { throw new Exception(tl("sellBulkPermission")); } List<ItemStack> is = ess.getItemDb().getMatching(user, args); int count = 0; boolean isBulk = is.size() > 1; for (ItemStack stack : is) { if (!ess.getSettings().allowSellNamedItems()) { if (stack.getItemMeta().hasDisplayName()) { if (!isBulk) { throw new Exception(tl("cannotSellNamedItem")); } else { user.sendMessage(tl("cannotSellThisNamedItem", stack.getItemMeta().getDisplayName())); continue; } } } try { if (stack.getAmount() > 0) { totalWorth = totalWorth.add(sellItem(user, stack, args, isBulk)); stack = stack.clone(); count++; for (ItemStack zeroStack : is) { if (zeroStack.isSimilar(stack)) { zeroStack.setAmount(0); } } } } catch (Exception e) { if (!isBulk) { throw e; } } } if (count != 1) { if (args[0].equalsIgnoreCase("blocks")) { user.sendMessage(tl("totalWorthBlocks", type, NumberUtil.displayCurrency(totalWorth, ess))); } else { user.sendMessage(tl("totalWorthAll", type, NumberUtil.displayCurrency(totalWorth, ess))); } } }

Target:
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { BigDecimal totalWorth = BigDecimal.ZERO; String type = ""; if (args.length < 1) { throw new NotEnoughArgumentsException(); } if (args[0].equalsIgnoreCase("hand") && !user.isAuthorized("essentials.sell.hand")) { throw new Exception(tl("sellHandPermission")); } else if ((args[0].equalsIgnoreCase("inventory") || args[0].equalsIgnoreCase("invent") || args[0].equalsIgnoreCase("all")) && !user.isAuthorized("essentials.sell.bulk")) { throw new Exception(tl("sellBulkPermission")); } List<ItemStack> is = ess.getItemDb().getMatching(user, args); int count = 0; boolean isBulk = is.size() > 1; for (ItemStack stack : is) { try { if (stack.getAmount() > 0) { totalWorth = totalWorth.add(sellItem(user, stack, args, isBulk)); stack = stack.clone(); count++; for (ItemStack zeroStack : is) { if (zeroStack.isSimilar(stack)) { zeroStack.setAmount(0); } } } } catch (Exception e) { if (!isBulk) { throw e; } } } if (count != 1) { if (args[0].equalsIgnoreCase("blocks")) { user.sendMessage(tl("totalWorthBlocks", type, NumberUtil.displayCurrency(totalWorth, ess))); } else { user.sendMessage(tl("totalWorthAll", type, NumberUtil.displayCurrency(totalWorth, ess))); } } }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(tagField); return result; }

Target:
public int hashCode() { return Arrays.hashCode(tagField); }
Source:
public void deployAfterRestart() { if (restarted) { LOG.info("App will be deployed from the previous checkpoint."); try { this.deployChangeInProgress.set(true); for (PTContainer c : getPhysicalPlan().getContainers()) { c.setState(PTContainer.State.NEW); requestContainer(c); for (PTOperator ptOperator : c.getOperators()) { ptOperator.setState(State.PENDING_DEPLOY); } } } finally { this.deployChangeCnt++; this.deployChangeInProgress.set(false); } } }

Target:
public void deployAfterRestart() { if (startedFromCheckpoint) { try { this.deployChangeInProgress.set(true); for (PTContainer c : getPhysicalPlan().getContainers()) { c.setState(PTContainer.State.NEW); requestContainer(c); for (PTOperator ptOperator : c.getOperators()) { ptOperator.setState(State.PENDING_DEPLOY); } } } finally { this.deployChangeCnt++; this.deployChangeInProgress.set(false); } } }
Source:
private Blob buildResult() throws IOException { Map<String, Object> result = new HashMap<>(); result.put("total", countTotal); result.put("success", countSuccess); return Blobs.createJSONBlobFromValue(Collections.singletonList(result)); }

Target:
private Blob buildResult() throws IOException { Map<String, Object> result = new HashMap<>(); result.put("total", countTotal); result.put("success", countSuccess); return Blobs.createJSONBlobFromValue(result); }
Source:
public JSONObjectResponse doInstallPlugins(StaplerRequest req) throws IOException { String payload = IOUtils.toString(req.getInputStream(), req.getCharacterEncoding()); JSONObject request = JSONObject.fromObject(payload); JSONArray pluginListJSON = request.getJSONArray("plugins"); List<String> plugins = new ArrayList<>(); for (int i = 0; i < pluginListJSON.size(); i++) { plugins.add(pluginListJSON.getString(i)); } UUID correlationId = UUID.randomUUID(); try { boolean dynamicLoad = request.getBoolean("dynamicLoad"); install(plugins, dynamicLoad, correlationId); JSONObject responseData = new JSONObject(); responseData.put("correlationId", correlationId.toString()); return new JSONObjectResponse(responseData); } catch (Exception e) { return new JSONObjectResponse().error(e.getMessage()); } }

Target:
public HttpResponse doInstallPlugins(StaplerRequest req) throws IOException { String payload = IOUtils.toString(req.getInputStream(), req.getCharacterEncoding()); JSONObject request = JSONObject.fromObject(payload); JSONArray pluginListJSON = request.getJSONArray("plugins"); List<String> plugins = new ArrayList<>(); for (int i = 0; i < pluginListJSON.size(); i++) { plugins.add(pluginListJSON.getString(i)); } UUID correlationId = UUID.randomUUID(); try { boolean dynamicLoad = request.getBoolean("dynamicLoad"); install(plugins, dynamicLoad, correlationId); JSONObject responseData = new JSONObject(); responseData.put("correlationId", correlationId.toString()); return hudson.util.HttpResponses.okJSON(responseData); } catch (Exception e) { return hudson.util.HttpResponses.errorJSON(e.getMessage()); } }
Source:
public Pool<Jedis> build(String name, JedisDriverProperties properties) { if (properties.connection == null || "".equals(properties.connection)) { throw new MissingRequiredConfiguration("Jedis client must have a connection defined"); } URI redisConnection = URI.create(properties.connection); String host = redisConnection.getHost(); int port = redisConnection.getPort() == -1 ? Protocol.DEFAULT_PORT : redisConnection.getPort(); int database = parseDatabase(redisConnection.getPath()); String password = parsePassword(redisConnection.getUserInfo()); GenericObjectPoolConfig objectPoolConfig = properties.poolConfig; return new InstrumentedJedisPool( new NoopRegistry(), new JedisPool(objectPoolConfig, host, port, properties.timeoutMs, password, database, name), idPrefix(name) ); }

Target:
public Pool<Jedis> build(String name, JedisDriverProperties properties) { if (properties.connection == null || "".equals(properties.connection)) { throw new MissingRequiredConfiguration("Jedis client must have a connection defined"); } URI redisConnection = URI.create(properties.connection); String host = redisConnection.getHost(); int port = redisConnection.getPort() == -1 ? Protocol.DEFAULT_PORT : redisConnection.getPort(); int database = parseDatabase(redisConnection.getPath()); String password = parsePassword(redisConnection.getUserInfo()); GenericObjectPoolConfig objectPoolConfig = properties.poolConfig; return new InstrumentedJedisPool( registry, new JedisPool(objectPoolConfig, host, port, properties.timeoutMs, password, database, name), name ); }
Source:
public Object execute(ExecutionEvent aEvent) throws ExecutionException { GerritTask item = null; GerritTableView reviewTableView = GerritTableView .getActiveView(); TableViewer viewer = reviewTableView.getTableViewer(); ISelection tableSelection = viewer.getSelection(); if (tableSelection.isEmpty()) { GerritUi.Ftracer.traceInfo("Selected table selection is EMPTY " ); } else { if (tableSelection instanceof IStructuredSelection ) { Object obj = ((IStructuredSelection) tableSelection).getFirstElement(); if (obj instanceof GerritTask) { item = (GerritTask) obj; try { reviewTableView.setStarred(item.getTaskId(), !item.getStarred(), new NullProgressMonitor() {}); item.toggleStarred(GerritTask.IS_STARRED, Boolean.toString(!Boolean.valueOf(item.getAttribute(GerritTask.IS_STARRED)))); } catch (CoreException e) { UIUtils.showErrorDialog(e.getMessage(), e.getStatus().getException().getMessage()); } viewer.update(item, null); } } } return item; }

Target:
public Object execute(ExecutionEvent aEvent) throws ExecutionException { final GerritTableView reviewTableView = GerritTableView .getActiveView(); final TableViewer viewer = reviewTableView.getTableViewer(); final ISelection tableSelection = viewer.getSelection(); final Job job = new Job(COMMAND_MESSAGE) { @Override protected IStatus run(IProgressMonitor monitor) { if (tableSelection.isEmpty()) { GerritUi.Ftracer.traceInfo("Selected table selection is EMPTY " ); } else { if (tableSelection instanceof IStructuredSelection ) { Object obj = ((IStructuredSelection) tableSelection).getFirstElement(); if (obj instanceof GerritTask) { item = (GerritTask) obj; try { reviewTableView.setStarred(item.getTaskId(), !item.getStarred(), monitor); item.toggleStarred(GerritTask.IS_STARRED, Boolean.toString(!Boolean.valueOf(item.getAttribute(GerritTask.IS_STARRED)))); } catch (CoreException e) { UIUtils.showErrorDialog(e.getMessage(), e.getStatus().getException().getMessage()); } Display.getDefault().asyncExec(new Runnable() { public void run() { viewer.update(item, null); } }); } } } return Status.OK_STATUS; }}; job.setUser(false); job.schedule(); return null; }
Source:
public void onFailed(final AvroElasticMemoryMessage msg) { if (msg.getOperationId() == null) { LOG.warning("No operationId provided. Ignoring msg " + msg); return; } final String operationId = msg.getOperationId().toString(); final EventHandler<AvroElasticMemoryMessage> handler = handlerMap.remove(operationId); if (handler == null) { LOG.warning("Failed to find callback for " + operationId + ". Ignoring msg " + msg); } else { handler.onNext(msg); } }

Target:
public void onFailed(final AvroElasticMemoryMessage msg) { if (msg.getOperationId() == null) { LOG.log(Level.WARNING, "No operationId provided. Ignoring msg {0}", msg); return; } final String operationId = msg.getOperationId().toString(); final EventHandler<AvroElasticMemoryMessage> handler = handlerMap.remove(operationId); if (handler == null) { LOG.log(Level.WARNING, "Failed to find callback for {0}. Ignoring msg {1}", new Object[]{operationId, msg}); } else { handler.onNext(msg); } }
Source:
public void trainModels(String trainingData) { Parser trainingParser = new POSBracketToToken(trainingData); Parser trainingParserUnknown = new POSLabeledUnknownWordParser(trainingData); MikheevTable.isTraining = true; BaselineTarget.isTraining = true; Object ex; while ((ex = trainingParser.next()) != null) { baselineTarget.learn(ex); mikheevTable.learn(ex); } baselineTarget.doneLearning(); mikheevTable.doneLearning(); trainingParser.reset(); POSTaggerUnknown.isTraining = true; POSTaggerKnown.isTraining = true; for (int i = 0; i < iter; i++) { logger.info("Training round " + i); while ((ex = trainingParser.next()) != null) { taggerKnown.learn(ex); } logger.info("\tFinished training " + rm.getString("knownName")); while ((ex = trainingParserUnknown.next()) != null) { taggerUnknown.learn(ex); } logger.info("\tFinished training " + rm.getString("unknownName")); trainingParser.reset(); trainingParserUnknown.reset(); taggerKnown.doneWithRound(); taggerUnknown.doneWithRound(); } taggerUnknown.doneLearning(); taggerKnown.doneLearning(); }

Target:
public void trainModels(String trainingData) { Parser trainingParser = new POSBracketToToken(trainingData); Parser trainingParserUnknown = new POSLabeledUnknownWordParser(trainingData); MikheevTable.isTraining = true; BaselineTarget.isTraining = true; Object ex; while ((ex = trainingParser.next()) != null) { baselineTarget.learn(ex); mikheevTable.learn(ex); } baselineTarget.doneLearning(); mikheevTable.doneLearning(); trainingParser.reset(); POSTaggerUnknown.isTraining = true; POSTaggerKnown.isTraining = true; for (int i = 0; i < iter; i++) { System.out.println("Training round " + i); while ((ex = trainingParser.next()) != null) { taggerKnown.learn(ex); } System.out.println("\tFinished training " + rm.getString("knownName")); while ((ex = trainingParserUnknown.next()) != null) { taggerUnknown.learn(ex); } System.out.println("\tFinished training " + rm.getString("unknownName")); trainingParser.reset(); trainingParserUnknown.reset(); taggerKnown.doneWithRound(); taggerUnknown.doneWithRound(); } taggerUnknown.doneLearning(); taggerKnown.doneLearning(); }
Source:
private void render(DiffInfo diff) { JsArray<Region> regions = diff.content(); int lineA = 0, lineB = 0; for (int i = 0; i < regions.length(); i++) { Region current = regions.get(i); if (current.ab() != null) { lineA += current.ab().length(); lineB += current.ab().length(); } else if (current.a() == null && current.b() != null) { int delta = current.b().length(); insertEmptyLines(cmA, delta, lineA - 1); lineB = colorLine(cmB, delta, lineB); } else if (current.a() != null && current.b() == null) { int delta = current.a().length(); insertEmptyLines(cmB, delta, lineB - 1); lineA = colorLine(cmA, delta, lineA); } else { int aLength = current.a().length(); int bLength = current.b().length(); lineA = colorLine(cmA, aLength, lineA); lineB = colorLine(cmB, bLength, lineB); if (aLength < bLength) { insertEmptyLines(cmA, bLength - aLength, lineA - 1); } else if (aLength > bLength) { insertEmptyLines(cmB, aLength - bLength, lineB - 1); } } } }

Target:
private void render(DiffInfo diff) { JsArray<Region> regions = diff.content(); int lineA = 0, lineB = 0; for (int i = 0; i < regions.length(); i++) { Region current = regions.get(i); if (current.ab() != null) { lineA += current.ab().length(); lineB += current.ab().length(); } else if (current.a() == null && current.b() != null) { int delta = current.b().length(); insertEmptyLines(cmA, lineA, delta); lineB = colorLines(cmB, lineB, delta); } else if (current.a() != null && current.b() == null) { int delta = current.a().length(); insertEmptyLines(cmB, lineB, delta); lineA = colorLines(cmA, lineA, delta); } else { int aLength = current.a().length(); int bLength = current.b().length(); lineA = colorLines(cmA, lineA, aLength); lineB = colorLines(cmB, lineB, bLength); if (aLength < bLength) { insertEmptyLines(cmA, lineA, bLength - aLength); } else if (aLength > bLength) { insertEmptyLines(cmB, lineB, aLength - bLength); } } } }
Source:
public EventAuthHeader(final String value) { super(HEADER_KEY, value.getBytes(Charsets.UTF_8)); }

Target:
public EventAuthHeader(final String value) { super(HEADER_KEY, value == null ? null : value.getBytes(Charsets.UTF_8)); }
Source:
public void onReceive(Context context, Intent intent) { if (Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE)) { Log.v(TAG, "Intent received: " + intent); } String action = intent.getAction(); if (action.equals(Mms.Intents.CONTENT_CHANGED_ACTION)) { Uri changed = (Uri) intent.getParcelableExtra(Mms.Intents.DELETED_CONTENTS); MmsApp.getApplication().getPduLoaderManager().removePdu(changed); } else if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) { if (mConnMgr == null) { mConnMgr = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); } NetworkInfo mmsNetworkInfo = mConnMgr .getNetworkInfo(ConnectivityManager.TYPE_MOBILE_MMS); if (mmsNetworkInfo == null) return; boolean available = mmsNetworkInfo.isAvailable(); boolean isConnected = mmsNetworkInfo.isConnected(); if (Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE)) { Log.v(TAG, "TYPE_MOBILE_MMS available = " + available + ", isConnected = " + isConnected); } if (available && !isConnected) { wakeUpService(context); } } else if (action.equals(Intent.ACTION_BOOT_COMPLETED)) { MessagingNotification.nonBlockingUpdateNewMessageIndicator( context, MessagingNotification.THREAD_NONE, false); wakeUpService(context); } }

Target:
public void onReceive(Context context, Intent intent) { if (Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE)) { Log.v(TAG, "Intent received: " + intent); } String action = intent.getAction(); if (action.equals(Mms.Intents.CONTENT_CHANGED_ACTION)) { Uri changed = (Uri) intent.getParcelableExtra(Mms.Intents.DELETED_CONTENTS); MmsApp.getApplication().getPduLoaderManager().removePdu(changed); } else if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) { if (mConnMgr == null) { mConnMgr = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); } NetworkInfo mmsNetworkInfo = mConnMgr .getNetworkInfo(ConnectivityManager.TYPE_MOBILE_MMS); if (mmsNetworkInfo == null) { return; } boolean available = mmsNetworkInfo.isAvailable(); boolean isConnected = mmsNetworkInfo.isConnected(); if (Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE)) { Log.v(TAG, "TYPE_MOBILE_MMS available = " + available + ", isConnected = " + isConnected); } if (available && !isConnected) { wakeUpService(context); } } else if (action.equals(Intent.ACTION_BOOT_COMPLETED)) { MessagingNotification.nonBlockingUpdateNewMessageIndicator( context, MessagingNotification.THREAD_NONE, false); wakeUpService(context); } }
Source:
public Node visitUpdate(SqlBaseParser.UpdateContext context) { var assignments = Lists2.map(context.assignment(), x -> (Assignment<Expression>) visit(x)); return new Update( (Relation) visit(context.aliasedRelation()), assignments, visitIfPresent(context.where(), Expression.class), getReturningClause(context.returning()) ); }

Target:
public Node visitUpdate(SqlBaseParser.UpdateContext context) { var assignments = Lists2.map(context.assignment(), x -> (Assignment<Expression>) visit(x)); return new Update( (Relation) visit(context.aliasedRelation()), assignments, visitIfPresent(context.where(), Expression.class), visitCollection(context.selectItem(), SelectItem.class) ); }
Source:
public List<MystromDevice> getDevices() { Reader reader = null; logger.info("get devices..."); try { HttpURLConnection httpURLConnection; httpURLConnection = (HttpURLConnection) new URL(API_URL + "devices" + "?authToken=" + this.authToken) .openConnection(); httpURLConnection.connect(); int responseCode = httpURLConnection.getResponseCode(); if (responseCode != HttpURLConnection.HTTP_OK) { logger.error("Get devices http code: '{}'", responseCode); return new ArrayList<MystromDevice>(); } InputStream inputStream = httpURLConnection.getInputStream(); reader = new InputStreamReader(inputStream, "UTF-8"); JsonObject jsonObject = (JsonObject) jsonParser.parse(reader); String status = jsonObject.get("status").getAsString(); if(!status.equals("ok")){ logger.error("Error while getting devices: '{}'", status); return new ArrayList<MystromDevice>(); } GetDevicesResult result = gson.fromJson(jsonObject, GetDevicesResult.class); logger.info("Devices discovery sucessfull, found '{}' devices", result.devices.size()); return result.devices; } catch(Exception ex){ logger.error("Error getting devices: '{}'", ex.toString()); return new ArrayList<MystromDevice>(); } finally { if (reader != null) { try { reader.close(); } catch (IOException ignored) { } } } }

Target:
public List<MystromDevice> getDevices() { Reader reader = null; logger.info("get devices..."); try { String url = API_URL + "devices" + "?authToken=" + this.authToken; HttpURLConnection httpURLConnection; httpURLConnection = (HttpURLConnection) new URL(url) .openConnection(); httpURLConnection.connect(); int responseCode = httpURLConnection.getResponseCode(); if (responseCode != HttpURLConnection.HTTP_OK) { logger.error("Get devices http code: '{}'", responseCode); return new ArrayList<MystromDevice>(); } InputStream inputStream = httpURLConnection.getInputStream(); reader = new InputStreamReader(inputStream, "UTF-8"); JsonObject jsonObject = (JsonObject) jsonParser.parse(reader); String status = jsonObject.get("status").getAsString(); if (!status.equals("ok")) { logger.error("Error while getting devices: '{}'", status); return new ArrayList<MystromDevice>(); } GetDevicesResult result = gson.fromJson(jsonObject, GetDevicesResult.class); logger.info("Devices discovery sucessfull, found '{}' devices", result.devices.size()); return result.devices; } catch (Exception ex) { logger.error("Error getting devices: '{}'", ex.toString()); return new ArrayList<MystromDevice>(); } finally { if (reader != null) { try { reader.close(); } catch (IOException ignored) { } } } }
Source:
static Object[] asArray(java.util.Iterator<?> it, int length) { final Object[] array = copy(empty(), length); for (int i = 0; i < length; i++) { array[i] = it.next(); } return array; }

Target:
static Object[] asArray(java.util.Iterator<?> it, int length) { final Object[] array = newInstance(length); for (int i = 0; i < length; i++) { array[i] = it.next(); } return array; }
Source:
public void testNonZeroExitCodeException() { DoNothingSoftwareProcessDriver sshRunner = mock(DoNothingSoftwareProcessDriver.class); when(sshRunner.execute(any(Map.class), any(List.class), any(String.class))).thenReturn(1); ScriptHelper scriptHelper = new ScriptHelper(sshRunner, "test-zero-code-task") .failOnNonZeroResultCode() .body.append(NON_ZERO_CODE_COMMAND); Asserts.assertTrue(scriptHelper.executeInternal() != 0, "ScriptHelper return zero code for non-zero code task"); }

Target:
public void testNonZeroExitCodeException() { DoNothingSoftwareProcessDriver sshRunner = mock(DoNothingSoftwareProcessDriver.class); when(sshRunner.execute(any(Map.class), any(List.class), any(String.class))).thenReturn(1); ScriptHelper scriptHelper = new ScriptHelper(sshRunner, "test-zero-code-task") .failOnNonZeroResultCode() .body.append(NON_ZERO_CODE_COMMAND); scriptHelper.executeInternal(); }
Source:
private List<String> getLocationStringList(List<Location> locationList) { List<String> list = new ArrayList<String>(); switch (edit_new) { case 0: list.add(getString(R.string.login_location_select)); for (int i = 0; i < locationList.size(); i++) { list.add(locationList.get(i).getDisplay()); } break; case 1: list.add(info.get(0)); for (int i = 0; i < locationList.size(); i++) { list.add(locationList.get(i).getDisplay()); } break; default: list.add(getString(R.string.login_location_select)); for (int i = 0; i < locationList.size(); i++) { list.add(locationList.get(i).getDisplay()); } break; } return list; }

Target:
private List<String> getLocationStringList(List<Location> locationList) { List<String> list = new ArrayList<String>(); switch (edit_new) { case "new_form": list.add(getString(R.string.login_location_select)); for (int i = 0; i < locationList.size(); i++) { list.add(locationList.get(i).getDisplay()); } break; case "edit_form": list.add(info.get(0)); for (int i = 0; i < locationList.size(); i++) { list.add(locationList.get(i).getDisplay()); } break; default: list.add(getString(R.string.login_location_select)); for (int i = 0; i < locationList.size(); i++) { list.add(locationList.get(i).getDisplay()); } break; } return list; }
Source:
public void testProcessWithRequiredVariable() throws Exception { KieBase kbase = createKnowledgeBase("variable-tags/approval-with-required-variable-tags.bpmn2"); KieSession ksession = createKnowledgeSession(kbase); TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler); Map<String, Object> parameters = new HashMap<>(); parameters.put("approver", "john"); ProcessInstance processInstance = ksession.startProcess("approvals", parameters); assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE); ksession = restoreSession(ksession, true); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler); WorkItem workItem = workItemHandler.getWorkItem(); assertNotNull(workItem); ksession.getWorkItemManager().completeWorkItem(workItem.getId(), null); workItem = workItemHandler.getWorkItem(); assertNotNull(workItem); ksession.getWorkItemManager().completeWorkItem(workItem.getId(), null); assertProcessInstanceFinished(processInstance, ksession); ksession.dispose(); }

Target:
public void testProcessWithRequiredVariable() throws Exception { ksession = createSessionAndRegisterWorkItemHandler("variable-tags/approval-with-required-variable-tags.bpmn2"); Map<String, Object> parameters = new HashMap<>(); parameters.put("approver", "john"); ProcessInstance processInstance = ksession.startProcess("approvals", parameters); assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE); ksession = restoreSession(ksession, true); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler); WorkItem workItem = workItemHandler.getWorkItem(); assertNotNull(workItem); ksession.getWorkItemManager().completeWorkItem(workItem.getId(), null); workItem = workItemHandler.getWorkItem(); assertNotNull(workItem); ksession.getWorkItemManager().completeWorkItem(workItem.getId(), null); assertProcessInstanceFinished(processInstance, ksession); }
Source:
protected Control createDialogArea(final Composite parent) { final Composite container = new Composite(parent, SWT.NULL); final GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginHeight = 9; layout.marginWidth = 9; container.setLayout(layout); GridData gd = new GridData(GridData.FILL_BOTH); container.setLayoutData(gd); final Label label = new Label(container, SWT.NULL); String labelText; if (getMessage() != null && getMessage().length() > 0) { labelText = getMessage(); } else { labelText = "Enter new name ("; if (isCaseSensitive) { labelText += "case sensitive"; } else { labelText += "case insensitive"; } labelText += "):"; } label.setText(labelText); text = new Text(container, SWT.SINGLE | SWT.BORDER); if (newName != null) { text.setText(newName); } else { text.setText(oldName); } text.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { textChanged(text.getText()); } }); gd = new GridData(GridData.FILL_HORIZONTAL); text.setLayoutData(gd); Dialog.applyDialogFont(container); return container; }

Target:
protected Control createDialogArea(final Composite parent) { final Composite container = new Composite(parent, SWT.NULL); final GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginHeight = 9; layout.marginWidth = 9; container.setLayout(layout); GridData gd = new GridData(GridData.FILL_BOTH); container.setLayoutData(gd); final Label label = new Label(container, SWT.NULL); String labelText; if (!StringUtil.isEmpty(getMessage())) { labelText = getMessage(); } else { labelText = "Enter new name ("; if (isCaseSensitive) { labelText += "case sensitive"; } else { labelText += "case insensitive"; } labelText += "):"; } label.setText(labelText); text = new Text(container, SWT.SINGLE | SWT.BORDER); if (newName != null) { text.setText(newName); } else { text.setText(oldName); } text.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { textChanged(text.getText()); } }); gd = new GridData(GridData.FILL_HORIZONTAL); text.setLayoutData(gd); Dialog.applyDialogFont(container); return container; }
Source:
private void setGotoCurrentLocationStatus() { mBtnGotoCurrentLocation.setEnabled(mLastDeviceLocation.getValue() != null || mHasEnabledLocationProviders); int fillColor; VectorDrawableCompat icon; if (mLastDeviceLocation.getValue() != null) { icon = VectorDrawableCompat.create(getResources(), R.drawable.ic_my_location_white_24dp, null); fillColor = mColorPrimary; } else if (mHasEnabledLocationProviders) { icon = VectorDrawableCompat.create(getResources(), R.drawable.ic_my_location_grey600_24dp, null); fillColor = mColorPrimaryWhite; } else { icon = VectorDrawableCompat.create(getResources(), R.drawable.ic_my_location_white_24dp, null); fillColor = mColorPrimaryButtonDisable; } mBtnGotoCurrentLocation.setImageDrawable(icon); mBtnGotoCurrentLocation.setBackgroundTintList(ColorStateList.valueOf(fillColor)); }

Target:
private void setGotoCurrentLocationStatus() { mBtnGotoCurrentLocation.setEnabled(mLastDeviceLocation.getValue() != null || mHasEnabledLocationProviders); int fillColor; VectorDrawableCompat icon; if (mLastDeviceLocation.getValue() != null) { icon = mIcMyLocationWhite; fillColor = mColorPrimary; } else if (mHasEnabledLocationProviders) { icon = mIcMyLocationGrey; fillColor = mColorPrimaryWhite; } else { icon = mIcMyLocationWhite; fillColor = mColorPrimaryButtonDisable; } mBtnGotoCurrentLocation.setImageDrawable(icon); mBtnGotoCurrentLocation.setBackgroundTintList(ColorStateList.valueOf(fillColor)); }
Source:
private void showEditorTip() { Preferences prefs = ConfigurationScope.INSTANCE.getNode("org.eclipse.egerrit.prefs"); Preferences editorPrefs = prefs.node("editor"); String choice = editorPrefs.get("editortip", "false"); if (choice.compareTo("false") != 0) { return; } MessageDialogWithToggle dialog = MessageDialogWithToggle.openInformation( tableFilesViewer.getControl().getShell(), Messages.FileTabView_EGerriTip, Messages.FileTabView_EGerriTipValue, Messages.FileTabView_EGerriTipShowAgain, false, null, null); if (dialog.getToggleState()) { editorPrefs.put("editortip", "true"); } return; }

Target:
private void showEditorTip() { Preferences prefs = ConfigurationScope.INSTANCE.getNode("org.eclipse.egerrit.prefs"); Preferences editorPrefs = prefs.node("editor"); boolean choice = editorPrefs.getBoolean("editortip", false); if (choice) { return; } MessageDialogWithToggle dialog = MessageDialogWithToggle.openInformation( tableFilesViewer.getControl().getShell(), Messages.FileTabView_EGerriTip, Messages.FileTabView_EGerriTipValue, Messages.FileTabView_EGerriTipShowAgain, false, null, null); if (dialog.getToggleState()) { editorPrefs.putBoolean("editortip", true); } return; }
Source:
public void onNext(final Message<ShuffleTupleMessage<Integer, Integer>> message) { for (final ShuffleTupleMessage<Integer, Integer> tupleMessage : message.getData()) { if (tupleMessage.size() == 0) { LOG.log(Level.INFO, "An empty shuffle message is arrived from {0}.", message.getSrcId()); } else { LOG.log(Level.INFO, "A shuffle message with size {0} is arrived from {1}.", new Object[]{tupleMessage.size(), message.getSrcId()}); } for (int i = 0; i < tupleMessage.size(); i++) { LOG.log(Level.INFO, tupleMessage.get(i).toString()); } } if (receivedIdSet.contains(message.getSrcId())) { throw new RuntimeException("Only one message from one task is allowed."); } else { receivedIdSet.add(message.getSrcId()); countDownLatch.countDown(); } }

Target:
public void onNext(final Message<ShuffleTupleMessage<Integer, Integer>> message) { for (final ShuffleTupleMessage<Integer, Integer> tupleMessage : message.getData()) { if (tupleMessage.size() == 0) { LOG.log(Level.INFO, "An empty shuffle message arrived from {0}.", message.getSrcId()); } else { LOG.log(Level.INFO, "A shuffle message with size {0} is arrived from {1}.", new Object[]{tupleMessage.size(), message.getSrcId()}); } for (int i = 0; i < tupleMessage.size(); i++) { LOG.log(Level.INFO, tupleMessage.get(i).toString()); } } if (receivedIdSet.contains(message.getSrcId())) { throw new RuntimeException("Only one message from one task is allowed."); } else { receivedIdSet.add(message.getSrcId()); countDownLatch.countDown(); } }
Source:
@Override public ConnectionFactory getConnectionFactory() throws JMSConnectorException { return super.getConnectionFactory(); }

Target:
public ConnectionFactory getConnectionFactory() throws JMSConnectorException { return super.getConnectionFactory(); }
Source:
public Response deleteIncomingPhoneNumber(final String accountSid, final String sid) { try{ Account operatedAccount = accountsDao.getAccount(accountSid); secure(operatedAccount, "RestComm:Delete:IncomingPhoneNumbers"); final IncomingPhoneNumber incomingPhoneNumber = dao.getIncomingPhoneNumber(new Sid(sid)); if (incomingPhoneNumber == null) { return status(NOT_FOUND).build(); } secure(operatedAccount, incomingPhoneNumber.getAccountSid(), SecuredType.SECURED_STANDARD); if(phoneNumberProvisioningManager != null && (incomingPhoneNumber.isPureSip() == null || !incomingPhoneNumber.isPureSip())) { phoneNumberProvisioningManager.cancelNumber(convertIncomingPhoneNumbertoPhoneNumber(incomingPhoneNumber)); } dao.removeIncomingPhoneNumber(new Sid(sid)); return noContent().build(); }catch(Exception e){ logger.error("", e); return status(INTERNAL_SERVER_ERROR).build(); } }

Target:
public Response deleteIncomingPhoneNumber(final String accountSid, final String sid) { Account operatedAccount = accountsDao.getAccount(accountSid); secure(operatedAccount, "RestComm:Delete:IncomingPhoneNumbers"); try{ final IncomingPhoneNumber incomingPhoneNumber = dao.getIncomingPhoneNumber(new Sid(sid)); if (incomingPhoneNumber == null) { return status(NOT_FOUND).build(); } secure(operatedAccount, incomingPhoneNumber.getAccountSid(), SecuredType.SECURED_STANDARD); if(phoneNumberProvisioningManager != null && (incomingPhoneNumber.isPureSip() == null || !incomingPhoneNumber.isPureSip())) { phoneNumberProvisioningManager.cancelNumber(convertIncomingPhoneNumbertoPhoneNumber(incomingPhoneNumber)); } dao.removeIncomingPhoneNumber(new Sid(sid)); return noContent().build(); }catch(Exception e){ logger.error("Exception while performing deleteIncomingPhoneNumber: ", e); return status(INTERNAL_SERVER_ERROR).build(); } }
Source:
public ChangesResult changes(PullFilter filter, Object since, Integer limit) { Map<String, Object> options = getParametrizedChangeFeedOptions(since, limit); if (filter != null) { if (filter instanceof PullDocIdsFilter) { String bodyParams = filter.getParameters().get("body"); return changesRequestWithPost(filter.getName(), bodyParams, since, limit); } else { String filterName = filter.getName(); Map filterParameters = filter.getParameters(); if (filterName != null) { options.put("filter", filterName); if (filterParameters != null) { options.putAll(filterParameters); } } } } return this.changes(options); }

Target:
public ChangesResult changes(PullFilter filter, Object since, Integer limit) { Map<String, Object> options = getParametrizedChangeFeedOptions(since, limit); if (filter != null) { String filterName = filter.getName(); Map filterParameters = filter.getParameters(); if (filterName != null) { options.put("filter", filterName); if (filterParameters != null) { options.putAll(filterParameters); } } } return this.changesRequestWithGet(options); }
Source:
public void testMapAssocSpacing() throws Exception { ErlangCodeStyleSettings erlangSettings = getErlangSettings(); erlangSettings.SPACE_AROUND_ARROW = true; doTest(); }

Target:
public void testMapAssocSpacing() throws Exception { ErlangCodeStyleSettings erlangSettings = getErlangSettings(); boolean prev = erlangSettings.SPACE_AROUND_ARROW; try { erlangSettings.SPACE_AROUND_ARROW = true; doTest(); } finally { erlangSettings.SPACE_AROUND_ARROW = prev; } }
Source:
public void handleAutoSavePostIfNotDraftResult(@NotNull AutoSavePostIfNotDraftResult result) { PostModel post = result.getPost(); SiteModel site = mSiteStore.getSiteByLocalId(post.getLocalSiteId()); if (result instanceof FetchPostStatusFailed) { mPostUploadNotifier.incrementUploadedPostCountFromForegroundNotification(post); mPostUploadNotifier.updateNotificationErrorForPost(post, site, post.error.message, 0); finishUpload(); } else if (result instanceof PostAutoSaveFailed) { mPostUploadNotifier.incrementUploadedPostCountFromForegroundNotification(post); mPostUploadNotifier.updateNotificationErrorForPost(post, site, post.error.message, 0); finishUpload(); } else if (result instanceof PostAutoSaved) { mPostUploadNotifier.incrementUploadedPostCountFromForegroundNotification(post); finishUpload(); } else if (result instanceof PostIsDraftInRemote) { post.setStatus(PostStatus.DRAFT.toString()); mDispatcher.dispatch(PostActionBuilder.newPushPostAction(new RemotePostPayload(post, site))); } else { throw new IllegalStateException("All AutoSavePostIfNotDraftResult types must be handled"); } }

Target:
public void handleAutoSavePostIfNotDraftResult(@NotNull AutoSavePostIfNotDraftResult result) { PostModel post = result.getPost(); if (result instanceof FetchPostStatusFailed || result instanceof PostAutoSaveFailed || result instanceof PostAutoSaved) { mPostUploadNotifier.incrementUploadedPostCountFromForegroundNotification(post); finishUpload(); } else if (result instanceof PostIsDraftInRemote) { post.setStatus(PostStatus.DRAFT.toString()); SiteModel site = mSiteStore.getSiteByLocalId(post.getLocalSiteId()); mDispatcher.dispatch(PostActionBuilder.newPushPostAction(new RemotePostPayload(post, site))); } else { throw new IllegalStateException("All AutoSavePostIfNotDraftResult types must be handled"); } }
Source:
public static Tracker getInstance() { register(); return instance; }

Target:
public static Tracker getInstance() { return instance; }
Source:
public void removeSubscription(String subscriptionId) { callbacks.remove(subscriptionId); String sitemapPage = pageOfSubscription.remove(subscriptionId); if (sitemapPage != null && !pageOfSubscription.values().contains(sitemapPage)) { PageChangeListener listener = pageChangeListeners.get(sitemapPage); if (listener != null) { pageChangeListeners.remove(sitemapPage); listener.dispose(); } } logger.debug("Removed subscription with id {}", subscriptionId); }

Target:
public void removeSubscription(String subscriptionId) { callbacks.remove(subscriptionId); String sitemapPage = pageOfSubscription.remove(subscriptionId); if (sitemapPage != null && !pageOfSubscription.values().contains(sitemapPage)) { PageChangeListener listener = pageChangeListeners.remove(sitemapPage); if (listener != null) { listener.dispose(); } } logger.debug("Removed subscription with id {}", subscriptionId); }
Source:
public static Slice allocateDirect(int capacity) { checkSliceCapacity(capacity); if (capacity == 0) { return EMPTY_SLICE; } return wrappedBuffer(ByteBuffer.allocateDirect(capacity)); }

Target:
public static Slice allocateDirect(int capacity) { if (capacity == 0) { return EMPTY_SLICE; } return wrappedBuffer(ByteBuffer.allocateDirect(capacity)); }