auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public IMarkerResolution[] getResolutions(IMarker marker) { ArrayList resolutions = new ArrayList(); for (Object resolutionQueryEntry : resolutionQueries.entrySet()) { Map.Entry entry = (Entry) resolutionQueryEntry; MarkerQuery query = (MarkerQuery) entry.getKey(); MarkerQueryResult result = query.performQuery(marker); if (result != null) { Map resultsTable = (Map) entry.getValue(); if (resultsTable.containsKey(result)) { Iterator elements = ((Collection) resultsTable.get(result)).iterator(); while (elements.hasNext()) { IConfigurationElement element = (IConfigurationElement) elements.next(); IMarkerResolutionGenerator generator = null; try { generator = (IMarkerResolutionGenerator) element.createExecutableExtension(ATT_CLASS); IMarkerResolution[] res = generator.getResolutions(marker); if (res == null) { for (IMarkerResolution generatedResolution : res) { resolutions.add(generatedResolution); } } else { StatusManager.getManager() .handle(new Status(IStatus.ERROR, IDEWorkbenchPlugin.IDE_WORKBENCH, IStatus.ERROR, "Failure in " + generator.getClass().getName() + " from plugin " + element.getContributor().getName() + ": getResolutions(IMarker) must not return null", null), StatusManager.LOG); } } catch (CoreException e) { Policy.handle(e); } } } } } return (IMarkerResolution[]) resolutions.toArray(new IMarkerResolution[resolutions.size()]); }

Target:
public IMarkerResolution[] getResolutions(IMarker marker) { ArrayList resolutions = new ArrayList(); for (Object resolutionQueryEntry : resolutionQueries.entrySet()) { Map.Entry entry = (Entry) resolutionQueryEntry; MarkerQuery query = (MarkerQuery) entry.getKey(); MarkerQueryResult result = query.performQuery(marker); if (result != null) { Map resultsTable = (Map) entry.getValue(); if (resultsTable.containsKey(result)) { Iterator elements = ((Collection) resultsTable.get(result)).iterator(); while (elements.hasNext()) { IConfigurationElement element = (IConfigurationElement) elements.next(); IMarkerResolutionGenerator generator = null; try { generator = (IMarkerResolutionGenerator) element.createExecutableExtension(ATT_CLASS); IMarkerResolution[] res = generator.getResolutions(marker); if (res != null) { for (IMarkerResolution generatedResolution : res) { resolutions.add(generatedResolution); } } else { StatusManager.getManager() .handle(new Status(IStatus.ERROR, IDEWorkbenchPlugin.IDE_WORKBENCH, IStatus.ERROR, "Failure in " + generator.getClass().getName() + " from plugin " + element.getContributor().getName() + ": getResolutions(IMarker) must not return null", null), StatusManager.LOG); } } catch (CoreException e) { Policy.handle(e); } } } } } return (IMarkerResolution[]) resolutions.toArray(new IMarkerResolution[resolutions.size()]); }
Source:
private void addNetworkPostData() { if (nics == null) { return; } VmInterfaceModel model = NewVmInterfaceModel.createInstance(getEntity().getStaticData(), getEntity().getStatus(), getEntity().getStoragePoolId(), getEntity().getVdsGroupCompatibilityVersion(), nics, this); setWindow(model); stopProgress(); }

Target:
private void addNetworkPostData() { if (nics == null) { return; } VmInterfaceModel model = NewGuideVmInterfaceModel.createInstance(getEntity().getStaticData(), getEntity().getStoragePoolId(), getEntity().getVdsGroupCompatibilityVersion(), nics, this); setWindow(model); stopProgress(); }
Source:
protected String prepareJsonPayload(Position position) { Map<String, Object> data = new HashMap<>(); if (position != null) { data.put(KEY_POSITION, position); } if (position.getDeviceId() != 0) { Device device = Context.getIdentityManager().getById(position.getDeviceId()); if (device != null) { data.put(KEY_DEVICE, device); } } try { return Context.getObjectMapper().writeValueAsString(data); } catch (JsonProcessingException e) { Log.warning(e); return null; } }

Target:
protected String prepareJsonPayload(Position position) { Map<String, Object> data = new HashMap<>(); Device device = Context.getIdentityManager().getById(position.getDeviceId()); if (position != null) { data.put(KEY_POSITION, position); } if (device != null) { data.put(KEY_DEVICE, device); } try { return Context.getObjectMapper().writeValueAsString(data); } catch (JsonProcessingException e) { Log.warning(e); return null; } }
Source:
public void decompress(ByteBuffer input, int compressedSize, ByteBuffer output, int uncompressedSize) throws IOException { output.clear(); try { DirectCodecPool.DECOMPRESS_METHOD.invoke(decompressor, (ByteBuffer) input.limit(compressedSize), (ByteBuffer) output.limit(uncompressedSize)); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } output.position(uncompressedSize); }

Target:
public void decompress(ByteBuffer input, int compressedSize, ByteBuffer output, int uncompressedSize) throws IOException { output.clear(); try { DECOMPRESS_METHOD.invoke(decompressor, (ByteBuffer) input.limit(compressedSize), (ByteBuffer) output.limit(uncompressedSize)); } catch (IllegalAccessException e) { throw new DirectCodecPool.ParquetCompressionCodecException(e); } catch (InvocationTargetException e) { throw new DirectCodecPool.ParquetCompressionCodecException(e); } output.position(uncompressedSize); }
Source:
public boolean postProcess(ClassCollection modelClasses) { for (Map.Entry<String, Set<String>> module : classesInModule.entrySet()) { Set<ClassMetaData> classData = new LinkedHashSet<>(); for (String qualifiedClassName : module.getValue()) { if (!modelClasses.containsQualifiedClass(qualifiedClassName)) { Utils.error(Utils.stripPackage(qualifiedClassName) + " could not be added to the module. " + "Only classes extending RealmObject, which are part of this project, can be added."); return false; } classData.add(modelClasses.getClassFromQualifiedName(qualifiedClassName)); } String qualifiedModuleClassName = module.getKey(); if (moduleAnnotations.get(qualifiedModuleClassName).library()) { libraryModules.put(qualifiedModuleClassName, classData); } else { modules.put(qualifiedModuleClassName, classData); } } if (modules.size() > 0 && libraryModules.size() > 0) { Utils.error("Normal modules and library modules cannot be mixed in the same project"); return false; } if (libraryModules.size() == 0 && modelClasses.size() > 0) { shouldCreateDefaultModule = true; String defaultModuleName = Constants.REALM_PACKAGE_NAME + "." + Constants.DEFAULT_MODULE_CLASS_NAME; modules.put(defaultModuleName, modelClasses.getClasses()); } return true; }

Target:
public boolean postProcess(ClassCollection modelClasses) { for (String qualifiedModuleClassName : globalModules) { Set<ClassMetaData> classData = new LinkedHashSet<>(); classData.addAll(modelClasses.getClasses()); defineModule(qualifiedModuleClassName, classData); } for (Map.Entry<String, Set<String>> module : specificClassesModules.entrySet()) { String qualifiedModuleClassName = module.getKey(); Set<ClassMetaData> classData = new LinkedHashSet<>(); for (String qualifiedModelClassName : module.getValue()) { if (!modelClasses.containsQualifiedClass(qualifiedModelClassName)) { Utils.error(Utils.stripPackage(qualifiedModelClassName) + " could not be added to the module. " + "Only classes extending RealmObject or implementing RealmModel, which are part of this project, can be added."); return false; } classData.add(modelClasses.getClassFromQualifiedName(qualifiedModelClassName)); } defineModule(qualifiedModuleClassName, classData); } if (modules.size() > 0 && libraryModules.size() > 0) { Utils.error("Normal modules and library modules cannot be mixed in the same project"); return false; } if (libraryModules.size() == 0 && modelClasses.size() > 0) { shouldCreateDefaultModule = true; String defaultModuleName = Constants.REALM_PACKAGE_NAME + "." + Constants.DEFAULT_MODULE_CLASS_NAME; modules.put(defaultModuleName, modelClasses.getClasses()); } return true; }
Source:
private Object[] buildClosedAccountsForItChartArgumentList(Map<String, Date> dateRange) { List<Object> argumentList = new ArrayList<>(); SimpleDateFormat formatter = new SimpleDateFormat(CUKFSConstants.DATE_FORMAT_dd_MMM_yy, Locale.US); argumentList.add(formatter.format(dateRange.get(CuCoaBatchConstants.ClosedAccountsFileCreationConstants.FROM_DATE))); argumentList.add(formatter.format(dateRange.get(CuCoaBatchConstants.ClosedAccountsFileCreationConstants.TO_DATE))); return argumentList.toArray(); }

Target:
private Object[] buildClosedAccountsForItChartArgumentList(Map<String, Date> dateRange) { List<Object> argumentList = new ArrayList<>(); argumentList.add(dateRange.get(CuCoaBatchConstants.ClosedAccountsFileCreationConstants.FROM_DATE)); argumentList.add(dateRange.get(CuCoaBatchConstants.ClosedAccountsFileCreationConstants.TO_DATE)); return argumentList.toArray(); }
Source:
public Consumer verifyAndLookupConsumerWithEntitlements(String consumerUuid) { Consumer consumer = this.findByUuid(consumerUuid); if (consumer == null) { throw new NotFoundException(i18nProvider.get().tr("Unit with ID \"{0}\" could not be found.", consumerUuid)); } for (Entitlement e : consumer.getEntitlements()) { Hibernate.initialize(e.getCertificates()); if (e.getPool() != null) { Hibernate.initialize(e.getPool().getProduct().getBranding()); Hibernate.initialize(e.getPool().getProductAttributes()); Hibernate.initialize(e.getPool().getAttributes()); Hibernate.initialize(e.getPool().getDerivedProductAttributes()); } } return consumer; }

Target:
public Consumer verifyAndLookupConsumerWithEntitlements(String consumerUuid) { Consumer consumer = this.findByUuid(consumerUuid); if (consumer == null) { throw new NotFoundException(i18nProvider.get().tr("Unit with ID \"{0}\" could not be found.", consumerUuid)); } for (Entitlement e : consumer.getEntitlements()) { Hibernate.initialize(e.getCertificates()); if (e.getPool() != null) { Hibernate.initialize(e.getPool().getProductAttributes()); Hibernate.initialize(e.getPool().getAttributes()); Hibernate.initialize(e.getPool().getDerivedProductAttributes()); } } return consumer; }
Source:
public String getLocalizedMessage() { return this.getLocalizedMessage(Locale.getDefault()); }

Target:
public String getLocalizedMessage() { return getLocalizedMessage(Locale.getDefault()); }
Source:
private static String buildPredicate(Column partitionKey, String value) { if (isQuotedType(partitionKey.getType())) { return String.format("(%s='%s')", partitionKey.getName(), value); } else { return String.format("(%s=%s)", partitionKey.getName(), value); } }

Target:
private static String buildPredicate(Column partitionKey, String value) { if (isQuotedType(partitionKey.getType())) { return String.format("(%s='%s')", partitionKey.getName(), value); } return String.format("(%s=%s)", partitionKey.getName(), value); }
Source:
public void startRemain() { if (outputEmitter != null) { } else { throw new RuntimeException("OutputEmitter should be set in " + SourceImpl.class.getName()); } }

Target:
protected void startRemain() { }
Source:
public static int indexOfChangeId(String message, String delimiter) { String[] lines = message.split(delimiter); int footerFirstLine = indexOfFirstFooterLine(lines); if (footerFirstLine == lines.length) return -1; int indexOfFooter = 0; for (int i = 0; i < footerFirstLine; ++i) { indexOfFooter += lines[i].length() + delimiter.length(); } return message.indexOf(CHANGE_ID, indexOfFooter); }

Target:
public static int indexOfChangeId(String message, String delimiter) { String[] lines = message.split(delimiter); int footerFirstLine = indexOfFirstFooterLine(lines); if (footerFirstLine == lines.length) return -1; int indexOfFooter = 0; for (int i = 0; i < footerFirstLine; ++i) indexOfFooter += lines[i].length() + delimiter.length(); return message.indexOf(CHANGE_ID, indexOfFooter); }
Source:
public static JobStatus replaceGeoFile(String blueprint, File file, UserPreferences userPrefs, SocrataConnectionInfo connectionInfo, String datasetID) { JobStatus status = JobStatus.SUCCESS; JSONParser parser = new JSONParser(); try { Object obj = parser.parse(blueprint); JSONObject array = (JSONObject)obj; if (array.containsKey("error")) { boolean error = (boolean) array.get("error"); if (error) { String message = array.get("message").toString(); logging.log(Level.INFO,message); JobStatus s = JobStatus.PUBLISH_ERROR; s.setMessage(message); return s; } } String fileId = array.get("fileId").toString(); String name = file.getName(); String bluepr = array.get("summary").toString(); String query = ""; query = query + "&fileId=" + URLEncoder.encode(fileId,"UTF-8"); query = query + "&name=" + URLEncoder.encode(name,"UTF-8"); query = query + "&blueprint=" + URLEncoder.encode(bluepr,"UTF-8"); query = query + "&viewUid=" + URLEncoder.encode(datasetID,"UTF-8"); URI uri = makeUri(connectionInfo.getUrl(),"replace",query); logging.log(Level.INFO,uri.toString()); status = postReplaceGeoFile(uri, connectionInfo, userPrefs); } catch (ParseException | UnsupportedEncodingException e) { String message = e.getMessage(); JobStatus s = JobStatus.PUBLISH_ERROR; s.setMessage(message); return s; } return status; }

Target:
public static JobStatus replaceGeoFile(String blueprint, File file, UserPreferences userPrefs, SocrataConnectionInfo connectionInfo, String datasetID) { JobStatus status = JobStatus.SUCCESS; JSONParser parser = new JSONParser(); try { Object obj = parser.parse(blueprint); JSONObject array = (JSONObject)obj; if (array.containsKey("error")) { boolean error = (boolean) array.get("error"); if (error) { String message = array.get("message").toString(); logging.log(Level.INFO,message); JobStatus s = JobStatus.PUBLISH_ERROR; s.setMessage(message); return s; } } String fileId = array.get("fileId").toString(); String name = file.getName(); String bluepr = array.get("summary").toString(); String query = ""; query = query + "&fileId=" + URLEncoder.encode(fileId,"UTF-8"); query = query + "&name=" + URLEncoder.encode(name,"UTF-8"); query = query + "&blueprint=" + URLEncoder.encode(bluepr,"UTF-8"); query = query + "&viewUid=" + URLEncoder.encode(datasetID,"UTF-8"); URI uri = makeUri(connectionInfo.getUrl(),"replace",query); logging.log(Level.INFO,uri.toString()); status = postReplaceGeoFile(uri, connectionInfo, userPrefs); return status; } catch (ParseException | UnsupportedEncodingException e) { String message = e.getMessage(); JobStatus s = JobStatus.PUBLISH_ERROR; s.setMessage(message); return s; } }
Source:
public FileMode getMode(File f, FS.Attributes attributes) { if (attributes.isSymbolicLink()) return FileMode.SYMLINK; else if (attributes.isDirectory()) { return FileMode.TREE; } else if (attributes.isExecutable()) return FileMode.EXECUTABLE_FILE; else return FileMode.REGULAR_FILE; }

Target:
public FileMode getMode(File f, FS.Attributes attributes) { if (attributes.isSymbolicLink()) { return FileMode.SYMLINK; } else if (attributes.isDirectory()) { return FileMode.TREE; } else if (attributes.isExecutable()) { return FileMode.EXECUTABLE_FILE; } else { return FileMode.REGULAR_FILE; } }
Source:
public Response<?> apply(ReviewerResource rsrc, Input input) throws AuthException, ResourceNotFoundException, OrmException, IOException { ChangeControl control = rsrc.getControl(); Change.Id changeId = rsrc.getChange().getId(); ReviewDb db = dbProvider.get(); StringBuilder msg = new StringBuilder(); msg.append("Removed the following approvals:\n\n"); db.changes().beginTransaction(changeId); try { List<PatchSetApproval> del = Lists.newArrayList(); for (PatchSetApproval a : approvals(db, rsrc)) { if (control.canRemoveReviewer(a)) { del.add(a); if (a.getValue() != 0) { msg.append("* ") .append(a.getLabel()).append(formatLabelValue(a.getValue())) .append(" by ").append(userFactory.create(a.getAccountId()).getNameEmail()) .append("\n"); } } else { throw new AuthException("delete not permitted"); } } if (del.isEmpty()) { throw new ResourceNotFoundException(); } ChangeUtil.bumpRowVersionNotLastUpdatedOn(rsrc.getChange().getId(), db); db.patchSetApprovals().delete(del); ChangeMessage changeMessage = new ChangeMessage(new ChangeMessage.Key(rsrc.getChange().getId(), ChangeUtil.messageUUID(db)), ((IdentifiedUser) control.getCurrentUser()).getAccountId(), TimeUtil.nowTs(), rsrc.getChange().currentPatchSetId()); changeMessage.setMessage(msg.toString()); db.changeMessages().insert(Collections.singleton(changeMessage)); db.commit(); } finally { db.rollback(); } indexer.index(rsrc.getChange()); return Response.none(); }

Target:
public Response<?> apply(ReviewerResource rsrc, Input input) throws AuthException, ResourceNotFoundException, OrmException, IOException { ChangeControl control = rsrc.getControl(); Change.Id changeId = rsrc.getChange().getId(); ReviewDb db = dbProvider.get(); StringBuilder msg = new StringBuilder(); db.changes().beginTransaction(changeId); try { List<PatchSetApproval> del = Lists.newArrayList(); for (PatchSetApproval a : approvals(db, rsrc)) { if (control.canRemoveReviewer(a)) { del.add(a); if (a.getValue() != 0) { if (msg.length() == 0) { msg.append("Removed the following approvals:\n\n"); } msg.append("* ") .append(a.getLabel()).append(formatLabelValue(a.getValue())) .append(" by ").append(userFactory.create(a.getAccountId()).getNameEmail()) .append("\n"); } } else { throw new AuthException("delete not permitted"); } } if (del.isEmpty()) { throw new ResourceNotFoundException(); } ChangeUtil.bumpRowVersionNotLastUpdatedOn(rsrc.getChange().getId(), db); db.patchSetApprovals().delete(del); if (msg.length() > 0) { ChangeMessage changeMessage = new ChangeMessage(new ChangeMessage.Key(rsrc.getChange().getId(), ChangeUtil.messageUUID(db)), ((IdentifiedUser) control.getCurrentUser()).getAccountId(), TimeUtil.nowTs(), rsrc.getChange().currentPatchSetId()); changeMessage.setMessage(msg.toString()); db.changeMessages().insert(Collections.singleton(changeMessage)); } db.commit(); } finally { db.rollback(); } indexer.index(rsrc.getChange()); return Response.none(); }
Source:
public synchronized Optional<DynamicFilterSummary> getSummary(String queryId, String source) { DynamicFilterSummaryWithSenders dynamicFilterSummaryWithSenders = dynamicFilterSummaries.get(SourceDescriptor.of(queryId, source)); return dynamicFilterSummaryWithSenders.getSummaryIfReady(); }

Target:
public synchronized ListenableFuture<DynamicFilterSummary> getSummary(String queryId, String source) { SettableFuture<DynamicFilterSummary> future = futures.get(SourceDescriptor.of(queryId, source)); if (future == null) { future = SettableFuture.create(); futures.put(SourceDescriptor.of(queryId, source), future); } DynamicFilterSummaryWithSenders dynamicFilterSummaryWithSenders = dynamicFilterSummaries.get(SourceDescriptor.of(queryId, source)); if (dynamicFilterSummaryWithSenders.getSummaryIfReady().isPresent()) { future.set(dynamicFilterSummaryWithSenders.getSummaryIfReady().get()); } return future; }
Source:
public void setLocale(Locale locale) { if (!Objects.equals(_locale, locale)) { _locale = locale; if (getFormat() == null) { if ("en_IN".equals(locale.toString())) { setFormat("en-IN"); } else { setFormat(getDefaultFormat()); } } invalidate(); } }

Target:
public void setLocale(Locale locale) { if (!Objects.equals(_locale, locale)) { _locale = locale; if (getFormat() == null) setFormat(getDefaultFormat()); invalidate(); } }
Source:
public void showInformationDialogTest() { Platform.runLater(() -> DialogMessage.showInformationDialog("Information", "Test Information Dialog")); sleep(1000); assertNodeExists(hasText("Test Information Dialog")); click("OK"); }

Target:
public void showInformationDialogTest() { Platform.runLater(() -> DialogMessage.showInformationDialog("Information", "Test Information Dialog")); waitUntilNodeAppears(hasText("Test Information Dialog")); assertNodeExists(hasText("Test Information Dialog")); click("OK"); }
Source:
public boolean isInterpolated() { return prefix().contains("F") || prefix().contains("f"); }

Target:
public boolean isInterpolated() { return prefix().equalsIgnoreCase("F"); }
Source:
public void enqueue(Callback callback) { AsyncTracer tracer = new AsyncTracer("OkHttp: acquire-limiter"); ListenableFuture<Limiter.Listener> limiterListener = limiter.acquire(); request().tag(ConcurrencyLimiterListener.class).setLimiterListener(limiterListener); Futures.addCallback(limiterListener, new FutureCallback<Limiter.Listener>() { @Override public void onSuccess(Limiter.Listener listener) { tracer.withTrace(() -> { Tracer.fastCompleteSpan(); request().tag(AsyncTracerTag.class).setAsyncTracer(new AsyncTracer("OkHttp: execute")); enqueueInternal(callback); Tracer.startSpan("ignored"); return null; }); } @Override public void onFailure(Throwable throwable) { callback.onFailure( RemotingOkHttpCall.this, new IOException(new AssertionError("This should never happen, since it implies " + "we failed when using the concurrency limiter", throwable))); } }, MoreExecutors.directExecutor()); }

Target:
public void enqueue(Callback callback) { AsyncTracer tracer = new AsyncTracer("OkHttp: acquire-limiter"); ListenableFuture<Limiter.Listener> limiterListener = limiter.acquire(); request().tag(ConcurrencyLimiterListener.class).setLimiterListener(limiterListener); Futures.addCallback(limiterListener, new FutureCallback<Limiter.Listener>() { @Override public void onSuccess(Limiter.Listener listener) { tracer.withTrace(() -> { Tracer.fastCompleteSpan(); request().tag(AsyncTracerTag.class).setAsyncTracer(new AsyncTracer("OkHttp: execute")); enqueueInternal(callback); Tracer.startSpan("ignored-span"); return null; }); } @Override public void onFailure(Throwable throwable) { callback.onFailure( RemotingOkHttpCall.this, new IOException(new AssertionError("This should never happen, since it implies " + "we failed when using the concurrency limiter", throwable))); } }, MoreExecutors.directExecutor()); }
Source:
public String toString() { return "Offset: " + offset + ", Size: " + getSize() + ", Flags: " + getFlags() + ", ExpiresAtMs: " + getExpiresAtMs() + ", Original Message Offset: " + getOriginalMessageOffset(); }

Target:
public String toString() { return "Offset: " + offset + ", Size: " + getSize() + ", Deleted: " + isFlagSet(Flags.Delete_Index) + ", ExpiresAtMs: " + getExpiresAtMs() + ", Original Message Offset: " + getOriginalMessageOffset(); }
Source:
void showCommitList(final Job j, final SWTCommitList list, final SWTCommit[] asArray, final boolean incomplete) { if (trace) GitTraceLocation.getTrace().traceEntry( GitTraceLocation.HISTORYVIEW.getLocation(), new Object[] { list, asArray }); if (job != j || graph.getControl().isDisposed()) return; graph.getControl().getDisplay().asyncExec(new Runnable() { public void run() { if (!graph.getControl().isDisposed() && job == j) { if (getFollowRenames()) { updateFollowFilter(); } graph.setInput(highlightFlag, list, asArray, input); if (trace) GitTraceLocation.getTrace().trace( GitTraceLocation.HISTORYVIEW.getLocation(), "Setting input to table"); findToolbar.setInput(highlightFlag, graph.getTableView() .getTable(), asArray); if (incomplete) setWarningText(UIText.GitHistoryPage_ListIncompleteWarningMessage); else setWarningText(null); setErrorMessage(null); } } }); if (trace) GitTraceLocation.getTrace().traceExit( GitTraceLocation.HISTORYVIEW.getLocation()); }

Target:
void showCommitList(final Job j, final SWTCommitList list, final SWTCommit[] asArray, final boolean incomplete) { if (trace) GitTraceLocation.getTrace().traceEntry( GitTraceLocation.HISTORYVIEW.getLocation(), new Object[] { list, asArray }); if (job != j || graph.getControl().isDisposed()) return; graph.getControl().getDisplay().asyncExec(new Runnable() { public void run() { if (!graph.getControl().isDisposed() && job == j) { if (getFollowRenames()) updateFollowFilter(); graph.setInput(highlightFlag, list, asArray, input); if (trace) GitTraceLocation.getTrace().trace( GitTraceLocation.HISTORYVIEW.getLocation(), "Setting input to table"); findToolbar.setInput(highlightFlag, graph.getTableView() .getTable(), asArray); if (incomplete) setWarningText(UIText.GitHistoryPage_ListIncompleteWarningMessage); else setWarningText(null); setErrorMessage(null); } } }); if (trace) GitTraceLocation.getTrace().traceExit( GitTraceLocation.HISTORYVIEW.getLocation()); }
Source:
public BaseEdit deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException { if (json.isJsonNull()) { return null; } if (!json.isJsonArray()) { throw new JsonParseException("Expected array for Edit type"); } final JsonArray o = (JsonArray) json; final int cnt = o.size(); if (cnt < 4 || cnt % 4 != 0) { throw new JsonParseException("Expected array of 4 for Edit type"); } if (4 == cnt) { return new BaseEdit(get(o, 0), get(o, 1), get(o, 2), get(o, 3)); } List<BaseEdit> l = new ArrayList<BaseEdit>((cnt / 4) - 1); for (int i = 4; i < cnt;) { int as = get(o, i++); int ae = get(o, i++); int bs = get(o, i++); int be = get(o, i++); l.add(new BaseEdit(as, ae, bs, be)); } return new LineEdit(get(o, 0), get(o, 1), get(o, 2), get(o, 3), l); }

Target:
public LineEdit deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException { if (json.isJsonNull()) { return null; } if (!json.isJsonArray()) { throw new JsonParseException("Expected array for Edit type"); } final JsonArray o = (JsonArray) json; final int cnt = o.size(); if (cnt < 4 || cnt % 4 != 0) { throw new JsonParseException("Expected array of 4 for Edit type"); } if (4 == cnt) { return new LineEdit(get(o, 0), get(o, 1), get(o, 2), get(o, 3)); } List<BaseEdit> l = new ArrayList<BaseEdit>((cnt / 4) - 1); for (int i = 4; i < cnt;) { int as = get(o, i++); int ae = get(o, i++); int bs = get(o, i++); int be = get(o, i++); l.add(new BaseEdit(as, ae, bs, be)); } return new LineEdit(get(o, 0), get(o, 1), get(o, 2), get(o, 3), l); }
Source:
public void testForceFreeMemory() throws Throwable { ArbitraryOutputBuffer buffer = createArbitraryBuffer(createInitialEmptyOutputBuffers(ARBITRARY), sizeOfPages(10)); for (int i = 0; i < 3; i++) { addPage(buffer, createPage(i)); } OutputBufferMemoryManager memoryManager = buffer.getMemoryManager(); assertTrue(memoryManager.getBufferedBytes() > 0); buffer.forceFreeMemory(); assertEquals(memoryManager.getBufferedBytes(), 0); try { addPage(buffer, createPage(1)); fail("Adding a page to a closed memoryManager should have failed"); } catch (IllegalStateException e) { } }

Target:
public void testForceFreeMemory() throws Throwable { ArbitraryOutputBuffer buffer = createArbitraryBuffer(createInitialEmptyOutputBuffers(ARBITRARY), sizeOfPages(10)); for (int i = 0; i < 3; i++) { addPage(buffer, createPage(i)); } OutputBufferMemoryManager memoryManager = buffer.getMemoryManager(); assertTrue(memoryManager.getBufferedBytes() > 0); buffer.forceFreeMemory(); assertEquals(memoryManager.getBufferedBytes(), 0); addPage(buffer, createPage(1)); assertEquals(memoryManager.getBufferedBytes(), 0); }
Source:
private void makeAttribute(final AttributeCol52 column) throws ConversionException { if (Objects.equals("negate", column.getAttribute().toLowerCase())) { throw new ConversionException("Conversion of the negate attribute is not supported."); } else { headerRow.createCell(columnIndex) .setCellValue(getAttribute(column)); } }

Target:
private void makeAttribute(final AttributeCol52 column) { if (Objects.equals("negate", column.getAttribute().toLowerCase())) { throw new UnsupportedOperationException("Conversion of the negate attribute is not supported."); } else { headerRow.createCell(columnIndex) .setCellValue(getAttribute(column)); } }
Source:
public synchronized void scheduleNext() { if (!isShutdown()) { if (fActiveTask == null) { schedule(); } else if (fActiveTask.getExecType() == ExecutionType.FOREGROUND) { if (fActiveTask.getThread().isCompleted()) { schedule(); } else { if (hasTasks()) { fActiveTask.getThread().suspend(); fForegroundTasks.add(fActiveTask); schedule(); } } } else if (fActiveTask.getExecType() == ExecutionType.BACKGROUND) { if (fActiveTask.getThread().isCompleted()) { schedule(); } else { if (hasTasks()) { fActiveTask.getThread().suspend(); fBackgroundTasks.add(fActiveTask); schedule(); } } } } }

Target:
private synchronized void scheduleNext() { if (!isShutdown()) { if (fActiveTask == null) { schedule(); } else if (fActiveTask.getExecType() == ExecutionType.FOREGROUND) { if (fActiveTask.getThread().isCompleted()) { schedule(); } else { if (hasTasks()) { fActiveTask.getThread().suspend(); fForegroundTasks.add(fActiveTask); schedule(); } } } else if (fActiveTask.getExecType() == ExecutionType.BACKGROUND) { if (fActiveTask.getThread().isCompleted()) { schedule(); } else { if (hasTasks()) { fActiveTask.getThread().suspend(); fBackgroundTasks.add(fActiveTask); schedule(); } } } } }
Source:
public String getQuestionWithoutExistingResponseSubmissionFormHtml( boolean sessionIsOpen, int qnIdx, int responseIdx, String courseId, int totalNumRecipients) { return Templates.populateTemplate( FormTemplates.TEXT_SUBMISSION_FORM, Slots.IS_SESSION_CLOSED, sessionIsOpen ? "false" : "true", Slots.FEEDBACK_RESPONSE_TEXT, Const.ParamsNames.FEEDBACK_RESPONSE_TEXT, Slots.QUESTION_INDEX, Integer.toString(qnIdx), Slots.RESPONSE_INDEX, Integer.toString(responseIdx), "${recommendedLengthDisplay}", recommendedLength == 0 ? "style=\"display:none\"" : "", "${recommendedLength}", Integer.toString(recommendedLength), Slots.TEXT_EXISTING_RESPONSE, ""); }

Target:
public String getQuestionWithoutExistingResponseSubmissionFormHtml( boolean sessionIsOpen, int qnIdx, int responseIdx, String courseId, int totalNumRecipients) { return Templates.populateTemplate( FormTemplates.TEXT_SUBMISSION_FORM, Slots.IS_SESSION_OPEN, Boolean.toString(sessionIsOpen), Slots.FEEDBACK_RESPONSE_TEXT, Const.ParamsNames.FEEDBACK_RESPONSE_TEXT, Slots.QUESTION_INDEX, Integer.toString(qnIdx), Slots.RESPONSE_INDEX, Integer.toString(responseIdx), "${recommendedLengthDisplay}", recommendedLength == 0 ? "style=\"display:none\"" : "", "${recommendedLength}", Integer.toString(recommendedLength), Slots.TEXT_EXISTING_RESPONSE, ""); }
Source:
public static CompletableFuture<FileWrapper> addReadOnlySharingLinkTo(FileWrapper sharedDir, AbsoluteCapability capability, NetworkAccess network, SafeRandom random, Fragmenter fragmenter) { return addSharingLinkTo(sharedDir, capability, network, random, fragmenter, CapabilityStore.READ_SHARING_FILE_PREFIX, CapabilityStore.READ_CAPABILITY_SIZE, CapabilityStore.SHARING_READ_FILE_MAX_SIZE); }

Target:
public static CompletableFuture<FileWrapper> addReadOnlySharingLinkTo(FileWrapper sharedDir, AbsoluteCapability capability, NetworkAccess network, SafeRandom random, Fragmenter fragmenter) { return addSharingLinkTo(sharedDir, capability.readOnly(), network, random, fragmenter, CapabilityStore.READ_SHARING_FILE_PREFIX, CapabilityStore.READ_CAPABILITY_SIZE, CapabilityStore.SHARING_READ_FILE_MAX_SIZE); }
Source:
public void hostsFailed(Set<Integer> failedHosts) { scheduleWork(new Runnable() { @Override public void run() { for (int hostId : failedHosts) { VoltZK.removeRejoinNodeIndicatorForHost(m_messenger.getZK(), hostId); } } }, 0, 0, TimeUnit.MILLISECONDS); }

Target:
public void hostsFailed(Set<Integer> failedHosts) { getSES(true).submit(new Runnable() { @Override public void run() { for (int hostId : failedHosts) { VoltZK.removeRejoinNodeIndicatorForHost(m_messenger.getZK(), hostId); } } }); }
Source:
public boolean equals(Object other) { if (other == this) { return true; } if (!(other instanceof SelectorSpec)) { return false; } SelectorSpec that = (SelectorSpec) other; boolean metadataGroupsEqual; if (groups.getMetadata().isPresent()) { metadataGroupsEqual = that.groups.getMetadata().isPresent() && that.groups.getMetadata().get().equals(groups.getMetadata().get()); } else { metadataGroupsEqual = !that.groups.getMetadata().isPresent(); } return (groups.getData().equals(that.groups.getData()) && metadataGroupsEqual && userRegex.map(Pattern::pattern).equals(that.userRegex.map(Pattern::pattern)) && userRegex.map(Pattern::flags).equals(that.userRegex.map(Pattern::flags)) && sourceRegex.map(Pattern::pattern).equals(that.sourceRegex.map(Pattern::pattern))) && sourceRegex.map(Pattern::flags).equals(that.sourceRegex.map(Pattern::flags)); }

Target:
public boolean equals(Object other) { if (other == this) { return true; } if (!(other instanceof SelectorSpec)) { return false; } SelectorSpec that = (SelectorSpec) other; return (group.equals(that.group) && queryType.equals(that.queryType) && userRegex.map(Pattern::pattern).equals(that.userRegex.map(Pattern::pattern)) && userRegex.map(Pattern::flags).equals(that.userRegex.map(Pattern::flags)) && sourceRegex.map(Pattern::pattern).equals(that.sourceRegex.map(Pattern::pattern))) && sourceRegex.map(Pattern::flags).equals(that.sourceRegex.map(Pattern::flags)); }
Source:
private CompletableFuture<WebSocket> connectAsync() { return httpClient .newWebSocketBuilder() .connectTimeout(Duration.ofMillis(DEFAULT_CONNECT_TIMEOUT_MILLIS)) .buildAsync(serverUri, webSocketListener); }

Target:
private CompletableFuture<WebSocket> connectAsync() { return httpClient .newWebSocketBuilder() .connectTimeout(Duration.ofMillis(DEFAULT_CONNECT_TIMEOUT_MILLIS)) .buildAsync(serverUri, internalListener); }
Source:
public <T> MessageHandlingMember<T> wrapHandler(MessageHandlingMember<T> original) { Optional<Method> unwrappedMethod = original.unwrap(Method.class); return unwrappedMethod.map(method -> Arrays.stream(method.getParameters()) .filter(parameter -> parameter.getType() .equals(QueryUpdateEmitter.class)) .findFirst() .map(parameter -> original.annotationAttributes(QueryHandler.class) .map(attr -> (MessageHandlingMember<T>) new MethodQueryMessageHandlerDefinition.MethodSubscriptionQueryMessageHandlingMember( original, attr, parameter)) .orElse(original)) .orElse(original.annotationAttributes(QueryHandler.class) .map(attr -> (MessageHandlingMember<T>) new MethodQueryMessageHandlerDefinition.MethodQueryMessageHandlingMember( original, attr)) .orElse(original))) .orElse(original); }

Target:
public <T> MessageHandlingMember<T> wrapHandler(MessageHandlingMember<T> original) { Optional<Method> unwrappedMethod = original.unwrap(Method.class); return unwrappedMethod.map(method -> Arrays.stream(method.getParameters()) .filter(parameter -> parameter.getType() .equals(QueryUpdateEmitter.class)) .findFirst() .map(parameter -> wrapToSubscriptionQueryMessageHandlingMember( original, parameter)) .orElse(wrapToQueryMessageHandlingMember(original))) .orElse(original); }
Source:
private Runnable getScheduleableAction(String actionName, Runnable runnable) { return () -> { try { runnable.run(); LOG.debug("Action: completed successfully.", actionName); if (Thread.currentThread().isInterrupted()) { LOG.warn("Action: is interrupted.", actionName); doCleanUpOnTaskException(new InterruptedException()); } } catch (Exception exception) { LOG.error("Execution of action: failed.", new Object[]{actionName, exception}); doCleanUpOnTaskException(exception); } }; }

Target:
private Runnable getScheduleableAction(String actionName, Runnable runnable) { return () -> { try { runnable.run(); if (Thread.currentThread().isInterrupted()) { LOG.warn("Action: is interrupted.", actionName); doCleanUpOnTaskException(new InterruptedException()); } else { LOG.debug("Action: completed successfully.", actionName); } } catch (Exception exception) { LOG.error("Execution of action: failed.", actionName, exception); doCleanUpOnTaskException(exception); } }; }
Source:
private void validateGatewayAccount(ValidatableResponse response) { response .body("containsKey('gateway_account')", is(true)) .body("gateway_account.gateway_account_id", is(Long.valueOf(accountId))) .body("gateway_account.containsKey('credentials')", is(false)) .body("gateway_account.service_name", is(serviceName)) .body("gateway_account.payment_provider", is(paymentProvider)) .body("gateway_account.type", is(type)) .body("gateway_account.analytics_id", is(analyticsId)) .body("gateway_account.corporate_credit_card_surcharge_amount", isNumber(0)) .body("gateway_account.corporate_debit_card_surcharge_amount", isNumber(0)) .body("gateway_account.card_types", is(notNullValue())) .body("gateway_account.card_types[0].id", is(notNullValue())) .body("gateway_account.card_types[0].label", is("MasterCard")) .body("gateway_account.card_types[0].type", is("DEBIT")) .body("gateway_account.card_types[0].brand", is("mastercard")) .body("gateway_account.card_types[1].id", is(notNullValue())) .body("gateway_account.card_types[1].label", is("Visa")) .body("gateway_account.card_types[1].type", is("CREDIT")) .body("gateway_account.card_types[1].brand", is("visa")); }

Target:
private void validateGatewayAccount(ValidatableResponse response) { response .body("containsKey('gateway_account')", is(true)) .body("gateway_account.gateway_account_id", is(Long.valueOf(accountId))) .body("gateway_account.containsKey('credentials')", is(false)) .body("gateway_account.service_name", is(serviceName)) .body("gateway_account.payment_provider", is(paymentProvider)) .body("gateway_account.type", is(type)) .body("gateway_account.analytics_id", is(analyticsId)) .body("gateway_account.corporate_credit_card_surcharge_amount", isNumber(corporateCreditCardSurchargeAmount)) .body("gateway_account.corporate_debit_card_surcharge_amount", isNumber(corporateDebitCardSurchargeAmount)) .body("gateway_account.card_types", is(notNullValue())) .body("gateway_account.card_types[0].id", is(notNullValue())) .body("gateway_account.card_types[0].label", is("MasterCard")) .body("gateway_account.card_types[0].type", is("DEBIT")) .body("gateway_account.card_types[0].brand", is("mastercard")) .body("gateway_account.card_types[1].id", is(notNullValue())) .body("gateway_account.card_types[1].label", is("Visa")) .body("gateway_account.card_types[1].type", is("CREDIT")) .body("gateway_account.card_types[1].brand", is("visa")); }
Source:
public Image getImage(final String imageIdOrName) { Optional<Image> image = tryFind(listImages(), new Predicate<Image>() { @Override public boolean apply(Image input) { return input.id().equals(imageIdOrName); } }); if (image.isPresent()) return image.get(); api.getImageApi().createImage(CreateImageOptions.Builder.fromImage(imageIdOrName)); return api.getImageApi().inspectImage(imageIdOrName); }

Target:
public Image getImage(final String imageIdOrName) { checkNotNull(imageIdOrName); if (imageIdOrName.startsWith("sha256")) { return find(listImages(), new Predicate<Image>() { @Override public boolean apply(Image input) { return input.id().equals(imageIdOrName); } }, null); } api.getImageApi().createImage(CreateImageOptions.Builder.fromImage(imageIdOrName)); return find(listImages(), new Predicate<Image>() { @Override public boolean apply(Image input) { for (String tag : input.repoTags()) { if (tag.equals(imageIdOrName) || tag.equals(imageIdOrName + ":latest")) { return true; } } return false; } }, null); }
Source:
public static EngineError forValue(int value) { return mappings.getOrDefault(value, ERROR_CODE_NOT_FOUND); }

Target:
public static EngineError forValue(int value) { return mappings.containsKey(value) ? mappings.get(value) : ERROR_CODE_NOT_FOUND; }
Source:
public static void addHeatRecipe(ILiquidStack output, ILiquidStack input, int temp) { init(); ModTweaker.LATE_ADDITIONS .add(new HighOven.AddHeat(InputHelper.toFluid(output), InputHelper.toFluid(input), temp + 300)); }

Target:
public static void addHeatRecipe(ILiquidStack output, ILiquidStack input, int temp) { init(); ModTweaker.LATE_ADDITIONS .add(new HighOven.AddHeat(InputHelper.toFluid(output), InputHelper.toFluid(input), temp)); }
Source:
public final Provider<List<Configuration>> getConfigurations() { return getProject() .provider(() -> getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().stream() .filter(ss -> !ss.getName().equals(IGNORE_MAIN_CONFIGURATION)) .map(SourceSet::getRuntimeClasspathConfigurationName) .map(getProject().getConfigurations()::getByName) .collect(toList())); }

Target:
public final Provider<List<Configuration>> getConfigurations() { return getProject().provider(() -> getProbablyTestSourceSets() .map(SourceSet::getRuntimeClasspathConfigurationName) .map(getProject().getConfigurations()::getByName) .collect(toList())); }
Source:
public void testSslWithClientAuthenticationMixed() { TrustStoreConfiguration serverTrustStoreConfig = TrustStoreConfiguration.builder() .path(TestConstants.CA_TRUST_STORE_PATH) .build(); KeyStoreConfiguration serverKeyStoreConfig = KeyStoreConfiguration.builder() .path(TestConstants.SERVER_KEY_STORE_JKS_PATH) .password(TestConstants.SERVER_KEY_STORE_JKS_PASSWORD) .build(); SslConfiguration serverConfig = SslConfiguration.builder() .trust(serverTrustStoreConfig) .key(serverKeyStoreConfig) .build(); TrustStoreConfiguration clientTrustStoreConfig = TrustStoreConfiguration.builder() .path(TestConstants.CA_TRUST_STORE_PATH) .build(); KeyStoreConfiguration clientKeyStoreConfig = KeyStoreConfiguration.builder() .path(TestConstants.CLIENT_KEY_STORE_P12_PATH) .type(TestConstants.CLIENT_KEY_STORE_P12_TYPE) .password(TestConstants.CLIENT_KEY_STORE_P12_PASSWORD) .build(); SslConfiguration clientConfig = SslConfiguration.builder() .trust(clientTrustStoreConfig) .key(clientKeyStoreConfig) .build(); runSslConnectionTest(serverConfig, clientConfig, ClientAuth.WITH_CLIENT_AUTH); }

Target:
public void testSslWithClientAuthenticationMixed() { TrustStoreConfiguration serverTrustStoreConfig = TrustStoreConfiguration.of(TestConstants.CA_TRUST_STORE_PATH); KeyStoreConfiguration serverKeyStoreConfig = KeyStoreConfiguration.of( TestConstants.SERVER_KEY_STORE_JKS_PATH, TestConstants.SERVER_KEY_STORE_JKS_PASSWORD); SslConfiguration serverConfig = SslConfiguration.of(serverTrustStoreConfig, serverKeyStoreConfig); TrustStoreConfiguration clientTrustStoreConfig = TrustStoreConfiguration.of(TestConstants.CA_TRUST_STORE_PATH); KeyStoreConfiguration clientKeyStoreConfig = KeyStoreConfiguration.builder() .path(TestConstants.CLIENT_KEY_STORE_P12_PATH) .type(TestConstants.CLIENT_KEY_STORE_P12_TYPE) .password(TestConstants.CLIENT_KEY_STORE_P12_PASSWORD) .build(); SslConfiguration clientConfig = SslConfiguration.of(clientTrustStoreConfig, clientKeyStoreConfig); runSslConnectionTest(serverConfig, clientConfig, ClientAuth.WITH_CLIENT_AUTH); }
Source:
private void setMargins() { int topMargin = mRenderer.getChartTitle().equals("") ? 0 : 30; int rightMargin = 20; int leftMargin = mRenderer.getYTitle().equals("") ? 50 : 70; int bottomMargin = mRenderer.getXTitle().equals("") ? 0 : 50; mRenderer.setMargins(new int[]{topMargin, leftMargin, bottomMargin, rightMargin}); }

Target:
private void setMargins() { int textAllowance = (int) mContext.getResources().getDimension(R.dimen.graph_text_margin); int topMargin = (int) mContext.getResources().getDimension(R.dimen.graph_y_margin); if (!mRenderer.getChartTitle().equals("")) { topMargin += textAllowance; } int rightMargin = (int) mContext.getResources().getDimension(R.dimen.graph_x_margin); int leftMargin = (int) mContext.getResources().getDimension(R.dimen.graph_x_margin); if (!mRenderer.getYTitle().equals("")) { leftMargin += textAllowance; } int bottomMargin = (int) mContext.getResources().getDimension(R.dimen.graph_y_margin); if (!mRenderer.getXTitle().equals("")) { bottomMargin += textAllowance; } mRenderer.setMargins(new int[]{topMargin, leftMargin, bottomMargin, rightMargin}); }
Source:
public String toString() { if (degubName == null) { degubName = getTokenType().toString(); if (!ApplicationManager.getApplication().isUnitTestMode()) { degubName += " " + getDebugName(); } } return degubName; }

Target:
public String toString() { String out = getTokenType().toString(); if (!ApplicationManager.getApplication().isUnitTestMode()) { out += " " + getDebugName(); } return out; }
Source:
public Object getValueAndReset() { Map<String, Object> ret = new ConcurrentHashMap<>(); for (Map.Entry<String, CountMetric> e : value.entrySet()) { ret.put(e.getKey(), e.getValue().getValueAndReset()); } return ret; }

Target:
public Object getValueAndReset() { Map<String, Object> ret = new HashMap<>(); for (Map.Entry<String, CountMetric> e : value.entrySet()) { ret.put(e.getKey(), e.getValue().getValueAndReset()); } return ret; }
Source:
public String getOvnCentralByClusterId(Guid clusterId) { List<Network> clusterNetworks = networkDao.getAllForCluster(clusterId); for (Provider provider : providerDao.getAllByTypes(ProviderType.EXTERNAL_NETWORK)) { for (Network network : clusterNetworks) { ProviderNetwork providerNetwork = network.getProvidedBy(); if (providerNetwork != null && providerNetwork.getProviderId().equals(provider.getId())) { return NetworkUtils.getIpAddress(provider.getUrl()); } } } return null; }

Target:
public String getOvnCentralByClusterId(Guid clusterId) { List<Network> clusterNetworks = networkDao.getAllForCluster(clusterId); for (Provider provider : providerDao.getAllByTypes(ProviderType.EXTERNAL_NETWORK)) { for (Network network : clusterNetworks) { if (network.isExternal() && network.getProvidedBy().getProviderId().equals(provider.getId())) { return NetworkUtils.getIpAddress(provider.getUrl()); } } } return null; }
Source:
private ArrayList<String> deleteNotesWithWrongFieldCounts(Runnable notifyProgress, JSONObject m) throws JSONException { Timber.d("deleteNotesWithWrongFieldCounts"); ArrayList<String> problems = new ArrayList<>(); ArrayList<Long> ids; ids = new ArrayList<>(); Cursor cur = null; try { notifyProgress.run(); cur = mDb.getDatabase().query("select id, flds from notes where mid = " + m.getLong("id"), null); Timber.d("cursor size: %d", cur.getCount()); int rowCount = 0; while (cur.moveToNext()) { try { Timber.d("Handling row: %d. Columns: %d", rowCount, cur.getColumnCount()); String flds = cur.getString(1); long id = cur.getLong(0); int fldsCount = 0; for (int i = 0; i < flds.length(); i++) { if (flds.charAt(i) == 0x1f) { fldsCount++; } } if (fldsCount + 1 != m.getJSONArray("flds").length()) { ids.add(id); } } catch (IllegalStateException ex) { AnkiDroidApp.sendExceptionReport(ex, "deleteNotesWithWrongFieldCounts"); } rowCount++; } notifyProgress.run(); if (ids.size() > 0) { problems.add("Deleted " + ids.size() + " note(s) with wrong field count."); _remNotes(Utils.arrayList2array(ids)); } } finally { if (cur != null && !cur.isClosed()) { cur.close(); } } return problems; }

Target:
private ArrayList<String> deleteNotesWithWrongFieldCounts(Runnable notifyProgress, JSONObject m) throws JSONException { Timber.d("deleteNotesWithWrongFieldCounts"); ArrayList<String> problems = new ArrayList<>(); ArrayList<Long> ids; ids = new ArrayList<>(); Cursor cur = null; try { notifyProgress.run(); cur = mDb.getDatabase().query("select id, flds from notes where mid = " + m.getLong("id"), null); Timber.i("cursor size: %d", cur.getCount()); int currentRow = 0; @Nullable Exception firstException = null; while (cur.moveToNext()) { try { String flds = cur.getString(1); long id = cur.getLong(0); int fldsCount = 0; for (int i = 0; i < flds.length(); i++) { if (flds.charAt(i) == 0x1f) { fldsCount++; } } if (fldsCount + 1 != m.getJSONArray("flds").length()) { ids.add(id); } } catch (IllegalStateException ex) { Timber.i(ex, "deleteNotesWithWrongFieldCounts - Exception on row %d. Columns: %d", currentRow, cur.getColumnCount()); if (firstException == null) { String details = String.format(Locale.ROOT, "deleteNotesWithWrongFieldCounts row: %d col: %d", currentRow, cur.getColumnCount()); AnkiDroidApp.sendExceptionReport(ex, details); firstException = ex; } } currentRow++; } Timber.i("deleteNotesWithWrongFieldCounts - completed successfully"); notifyProgress.run(); if (ids.size() > 0) { problems.add("Deleted " + ids.size() + " note(s) with wrong field count."); _remNotes(Utils.arrayList2array(ids)); } } finally { if (cur != null && !cur.isClosed()) { cur.close(); } } return problems; }
Source:
static QualifiedColumnMapperFactory adapt(ColumnMapperFactory factory) { Set<Annotation> qualifiers = new Qualifiers().qualifiers(factory.getClass()); return (type, config) -> type.getQualifiers().equals(qualifiers) ? factory.build(type.getType(), config) : Optional.empty(); }

Target:
static QualifiedColumnMapperFactory adapt(ColumnMapperFactory factory) { return (type, config) -> type.getQualifiers().equals( config.get(Qualifiers.class).findFor(factory.getClass())) ? factory.build(type.getType(), config) : Optional.empty(); }