auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void readCardText(final Card card, final int cardSide) { int qa; String html; if (Sound.SOUNDS_QUESTION == cardSide) { html = card.q(true); qa = Sound.SOUNDS_QUESTION; } else if (Sound.SOUNDS_ANSWER == cardSide) { html = card.getPureAnswer(); qa = Sound.SOUNDS_ANSWER; } else { Timber.w("Unrecognised cardSide"); return; } long deckId = getDeckIdForCard(card); int ord = card.getOrd(); boolean isFirstText = true; for (LocalisedText textToRead : getTextsToRead(html)) { if (!textToRead.getText().isEmpty()) { ReadText.textToSpeech(textToRead.getText(), deckId, ord, qa, textToRead.getLocaleCode(), isFirstText ? TextToSpeech.QUEUE_FLUSH : TextToSpeech.QUEUE_ADD); isFirstText = false; } } }

Target:
private static void readCardText(final Card card, final int cardSide) { final String cardSideContent; if (Sound.SOUNDS_QUESTION == cardSide) { cardSideContent = card.q(true); } else if (Sound.SOUNDS_ANSWER == cardSide) { cardSideContent = card.getPureAnswer(); } else { Timber.w("Unrecognised cardSide"); return; } ReadText.readCardSide(cardSide, cardSideContent, getDeckIdForCard(card), card.getOrd()); }
Source:
public void readSpongeNbt(NBTTagCompound nbt) { this.uuid = new UUID(nbt.getLong(NbtDataUtil.WORLD_UUID_MOST), nbt.getLong(NbtDataUtil.WORLD_UUID_LEAST)); this.dimension = nbt.getInteger(NbtDataUtil.DIMENSION_ID); this.isMod = nbt.getBoolean(NbtDataUtil.IS_MOD); DimensionTypeRegistryModule.getInstance().getAll().stream().filter(type -> type.getId().equalsIgnoreCase(nbt.getString(NbtDataUtil.DIMENSION_TYPE))) .forEach(type -> this.dimensionType = type); this.trackedUniqueIdCount = 0; for (int i = 0; i < this.playerUniqueIdNbt.tagCount(); i++) { NBTTagCompound valueNbt = this.playerUniqueIdNbt.getCompoundTagAt(i); UUID uuid = new UUID(valueNbt.getLong(NbtDataUtil.WORLD_UUID_MOST), valueNbt.getLong(NbtDataUtil.WORLD_UUID_LEAST)); this.playerUniqueIdMap.put(this.trackedUniqueIdCount, uuid); this.trackedUniqueIdCount++; } }

Target:
public void readSpongeNbt(NBTTagCompound nbt) { this.uuid = nbt.getUniqueId(NbtDataUtil.UUID); this.dimension = nbt.getInteger(NbtDataUtil.DIMENSION_ID); this.isMod = nbt.getBoolean(NbtDataUtil.IS_MOD); final String dimensionTypeId = nbt.getString(NbtDataUtil.DIMENSION_TYPE); this.dimensionType = DimensionTypeRegistryModule.getInstance().getById(dimensionTypeId) .orElseThrow(FunctionalUtil.invalidArgument("Could not find a DimensionType by id: " + dimensionTypeId)); this.trackedUniqueIdCount = 0; if (nbt.hasKey(NbtDataUtil.SPONGE_PLAYER_UUID_TABLE, NbtDataUtil.TAG_LIST)) { final NBTTagList playerIdList = nbt.getTagList(NbtDataUtil.SPONGE_PLAYER_UUID_TABLE, NbtDataUtil.TAG_COMPOUND); for (int i = 0; i < playerIdList.tagCount(); i++) { final NBTTagCompound playerId = playerIdList.getCompoundTagAt(i); final UUID playerUuid = playerId.getUniqueId(NbtDataUtil.UUID); this.playerUniqueIdMap.put(this.trackedUniqueIdCount++, playerUuid); } } }
Source:
public void mapAndSend(Event[] events, OutputTransportCallback outputTransportCallback, OptionHolder optionHolder, TemplateBuilder payloadTemplateBuilder) throws ConnectionUnavailableException { if (events.length < 1) { return; } StringBuilder sb = new StringBuilder(); if (payloadTemplateBuilder != null) { if (prefixXml != null) { sb.append(prefixXml); } for (Event event : events) { sb.append(payloadTemplateBuilder.build(event)); } if (suffixXml != null) { sb.append(suffixXml); } if (xmlValidationEnabled) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); factory.setNamespaceAware(true); try { DocumentBuilder builder = factory.newDocumentBuilder(); builder.parse(new ByteArrayInputStream(sb.toString().getBytes())); } catch (ParserConfigurationException e) { log.error("Error occurred when trying to validate output XML event for well-formedness. " + "Dropping event: " + sb.toString()); return; } catch (SAXException e) { log.error("Parse error occurred when validating output XML event for well-formedness. " + "Reason: " + e.getMessage() + "Dropping event: " + sb.toString()); return; } catch (IOException e) { log.error("IO error occurred when validating output XML event for well-formedness. " + "Reason: " + e.getMessage() + "Dropping event: " + sb.toString()); return; } } } else { for (Event event : events) { sb.append(constructDefaultMapping(event)); } } outputTransportCallback.publish(sb.toString(), events[0]); }

Target:
public void mapAndSend(Event[] events, OutputTransportCallback outputTransportCallback, OptionHolder optionHolder, TemplateBuilder payloadTemplateBuilder) throws ConnectionUnavailableException { if (events.length < 1) { return; } StringBuilder sb = new StringBuilder(); if (payloadTemplateBuilder != null) { if (prefixXml != null) { sb.append(prefixXml); } for (Event event : events) { sb.append(payloadTemplateBuilder.build(event)); } if (suffixXml != null) { sb.append(suffixXml); } if (xmlValidationEnabled) { try { builder.parse(new ByteArrayInputStream(sb.toString().getBytes())); builder.reset(); } catch (SAXException e) { log.error("Parse error occurred when validating output XML event for well-formedness. " + "Reason: " + e.getMessage() + "Dropping event: " + sb.toString()); return; } catch (IOException e) { log.error("IO error occurred when validating output XML event for well-formedness. " + "Reason: " + e.getMessage() + "Dropping event: " + sb.toString()); return; } } } else { for (Event event : events) { sb.append(constructDefaultMapping(event)); } } outputTransportCallback.publish(sb.toString(), events[0]); }
Source:
public static EnumActionResult onInteractEntityAt(EntityPlayer player, Entity entity, RayTraceResult ray, ItemStack stack, EnumHand hand) { Vec3d vec3d = new Vec3d(ray.hitVec.xCoord - entity.posX, ray.hitVec.yCoord - entity.posY, ray.hitVec.zCoord - entity.posZ); return onInteractEntityAt(player, entity, vec3d, stack, hand); }

Target:
public static boolean onInteractEntityAt(EntityPlayer player, Entity entity, RayTraceResult ray, ItemStack stack, EnumHand hand) { return onInteractEntityAtAction(player, entity, ray, stack, hand) != null; }
Source:
default EventStream<PlainTextChange> plainChanges() { return richChanges() .filter(c -> c.insertedLength() != 0 || c.removedLength() != 0) .map(c -> new PlainTextChange(c.position, c.removed.getText(), c.inserted.getText())); }

Target:
default EventStream<PlainTextChange> plainChanges() { return richChanges() .map(c -> new PlainTextChange(c.position, c.removed.getText(), c.inserted.getText())) .filter(pc -> !pc.removed.equals(pc.inserted)); }
Source:
public static byte[] convertIP6Address(String fullFormIP6Address) throws KuraException { if (fullFormIP6Address == null) { throw new KuraException(KuraErrorCode.INVALID_PARAMETER); } byte[] retVal = new byte[16]; String[] ip6Split = fullFormIP6Address.split(":"); if (ip6Split.length != 8) { throw new KuraException(KuraErrorCode.INVALID_PARAMETER); } for (int i = 0; i < 8; i++) { try { String octet = ip6Split[i]; int value = Integer.parseInt(octet, 16); if ((value < 0) || (value > 0xFFFF)) { throw new KuraException(KuraErrorCode.INVALID_PARAMETER); } int k = i * 2; retVal[k] = (byte) ((value >>> 8) & 0xFF); retVal[k + 1] = (byte) (value & 0xFF); } catch (NumberFormatException e) { throw new KuraException(KuraErrorCode.INVALID_PARAMETER); } } return retVal; }

Target:
public static byte[] convertIP6Address(String fullFormIP6Address) { if (fullFormIP6Address == null) { throw new IllegalArgumentException("fullFormIP6Address is null"); } byte[] retVal = new byte[16]; String[] ip6Split = fullFormIP6Address.split(":"); if (ip6Split.length != 8) { throw new IllegalArgumentException("fullFormIP6Address is invalid: " + fullFormIP6Address); } for (int i = 0; i < 8; i++) { try { String octet = ip6Split[i]; int value = Integer.parseInt(octet, 16); if ((value < 0) || (value > 0xFFFF)) { throw new IllegalArgumentException("fullFormIP6Address is invalid: " + fullFormIP6Address); } int k = i * 2; retVal[k] = (byte) ((value >>> 8) & 0xFF); retVal[k + 1] = (byte) (value & 0xFF); } catch (NumberFormatException e) { throw new IllegalArgumentException("fullFormIP6Address is invalid: " + fullFormIP6Address, e); } } return retVal; }
Source:
private void runInProtocolStage(final Runnable task) { synchronized(executor) { if (executor == null || executor.isShutdown()) { LOGGER.log(Level.WARNING, "Trying to use already shutdown executor. Replacing it with default"); initDefaultExecutor(); } executor.execute(new Runnable() { public void run() { try { task.run(); } catch (Throwable t) { LOGGER.log(Level.SEVERE, "Exception in protocol stage thread: "+t.getMessage(), t); } } }); } }

Target:
private void runInProtocolStage(final Runnable task) { executor.execute(new Runnable() { public void run() { try { task.run(); } catch (Throwable t) { LOGGER.log(Level.SEVERE, "Exception in protocol stage thread: "+t.getMessage(), t); } } }); }
Source:
private String getQueryForGroup() { return "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<request>\n" + "<skupina_clenove reqid=\"5\">\n" + "<skupina_id></skupina_id>\n" + "<pracoviste_id>" + getAttributes().get("workplaceId") + "</pracoviste_id>\n" + "<zkratka>" + getAttributes().get("groupName") + "</zkratka>\n" + "<operace>INF</operace>\n" + "</skupina_clenove>\n" + "</request>"; }

Target:
private String getQueryForGroup() throws InternalErrorException { log.debug("RequestID for ISXML ExtSource group " + workplace + ":" + groupName + " = " + requestID); return "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<request>\n" + "<skupina_clenove reqid=\"" + requestID + "\">\n" + "<skupina_id></skupina_id>\n" + "<pracoviste_id>" + workplace + "</pracoviste_id>\n" + "<zkratka>" + groupName + "</zkratka>\n" + "<operace>INF</operace>\n" + "</skupina_clenove>\n" + "</request>"; }
Source:
private String appendPrefix(String prefix, String key) { if (prefix.isEmpty()) { return key; } else { return prefix.concat(".".concat(key)); } }

Target:
private String appendPrefix(String prefix, String key) { return prefix.isEmpty() ? key : prefix + "." + key; }
Source:
private Response tryAuth(Request authRequest) throws IOException { return okClient .newBuilder() .authenticator(new Authenticator() { @Override public Request authenticate(Route route, Response response) throws IOException { if(StringUtils.isNotBlank(response.request().header(AUTH_ATTEMPTS))) { return null; } if(StringUtils.isNotBlank(response.header(IHttpConstants.PROPERTY_WWW_AUTHENTICATE))) { for (IChallangeHandler challangeHandler : challangeHandlers) { if(!challangeHandler.canHandle(response.headers())) { Builder requestBuilder = response.request().newBuilder() .header(AUTH_ATTEMPTS, "1"); return challangeHandler.handleChallange(requestBuilder).build(); } } } return null; } }) .build() .newCall(authRequest).execute(); }

Target:
private Response tryAuth(Request authRequest) throws IOException { return okClient .newBuilder() .authenticator(new Authenticator() { @Override public Request authenticate(Route route, Response response) throws IOException { if(StringUtils.isNotBlank(response.request().header(AUTH_ATTEMPTS))) { return null; } if(StringUtils.isNotBlank(response.header(IHttpConstants.PROPERTY_WWW_AUTHENTICATE))) { for (IChallangeHandler challangeHandler : challangeHandlers) { if(!challangeHandler.canHandle(response.headers())) { Builder requestBuilder = response.request().newBuilder() .header(AUTH_ATTEMPTS, "1"); return challangeHandler.handleChallange(requestBuilder).build(); } } } return null; } }) .followRedirects(false) .followRedirects(false) .build() .newCall(authRequest).execute(); }
Source:
private static void autoDetectConvertersInternally(DataContext dataContext, Table table, List<Column> columns, int sampleSize, Map<Column, TypeConverter<?, ?>> result) { if (columns == null || columns.size() == 0) { return; } Map<Column, ColumnTypeDetector> detectors = new HashMap<Column, ColumnTypeDetector>(); for (Column column : columns) { detectors.put(column, new ColumnTypeDetector()); } Query query = dataContext.query().from(table).select(columns.toArray(new Column[columns.size()])).toQuery(); if (sampleSize > 0 && sampleSize != Integer.MAX_VALUE) { query.setMaxRows(sampleSize); } DataSet dataSet = dataContext.executeQuery(query); try { while (dataSet.next()) { Row row = dataSet.getRow(); for (Column column : columns) { String stringValue = (String) row.getValue(column); ColumnTypeDetector detector = detectors.get(column); detector.registerValue(stringValue); } } } finally { dataSet.close(); } for (Column column : columns) { ColumnTypeDetector detector = detectors.get(column); TypeConverter<?, ?> converter = detector.createConverter(); if (converter != null) { result.put(column, converter); } } }

Target:
private static void autoDetectConvertersInternally(DataContext dataContext, Table table, List<Column> columns, int sampleSize, Map<Column, TypeConverter<?, ?>> result) { if (columns == null || columns.size() == 0) { return; } Map<Column, ColumnTypeDetector> detectors = new HashMap<Column, ColumnTypeDetector>(); for (Column column : columns) { detectors.put(column, new ColumnTypeDetector()); } Query query = dataContext.query().from(table).select(columns).toQuery(); if (sampleSize > 0 && sampleSize != Integer.MAX_VALUE) { query.setMaxRows(sampleSize); } DataSet dataSet = dataContext.executeQuery(query); try { while (dataSet.next()) { Row row = dataSet.getRow(); for (Column column : columns) { String stringValue = (String) row.getValue(column); ColumnTypeDetector detector = detectors.get(column); detector.registerValue(stringValue); } } } finally { dataSet.close(); } for (Column column : columns) { ColumnTypeDetector detector = detectors.get(column); TypeConverter<?, ?> converter = detector.createConverter(); if (converter != null) { result.put(column, converter); } } }
Source:
public void testMakeWriterForBamExtension() throws IOException { final File tmpFile = File.createTempFile("testMakeWriterForBamExtension", ".bam"); tmpFile.deleteOnExit(); final SAMFileWriter samFileWriter = new SAMFileWriterFactory().makeWriter(new SAMFileHeader(), true, tmpFile, null); samFileWriter.close(); Assert.assertTrue(SamStreams.isBAMFile(new BufferedInputStream (new SeekableFileStream(tmpFile)))); }

Target:
public void testMakeWriterForBamExtension() throws IOException { final File tmpFile = File.createTempFile("testMakeWriterForBamExtension", "." + BAM_TYPE.fileExtension()); tmpFile.deleteOnExit(); try (SAMFileWriter samFileWriter = new SAMFileWriterFactory().makeWriter(new SAMFileHeader(), true, tmpFile, null)) Assert.assertTrue(SamStreams.isBAMFile(new BufferedInputStream(new SeekableFileStream(tmpFile)))); }
Source:
public Responder makeResponder(Request request) throws InstantiationException, IOException { String resource = request.getResource(); String responderKey = getResponderKey(request); Responder responder=matchResponder(resource); if (responder==null) { if (usingResponderKey(responderKey)) { responder = wrapWithFilters(responderKey, lookupResponder(responderKey)); } else if (resource.startsWith("files/") || resource.equals("files")) { responder = wrapWithFilters("files", new FileResponder()); } else if (StringUtils.isBlank(resource) || PathParser.parse(resource) != null) { responder = wrapWithFilters("wiki", new WikiPageResponder()); } else { responder = new NotFoundResponder(); } } return responder; }

Target:
public Responder makeResponder(Request request) throws InstantiationException, IOException { String resource = request.getResource(); String responderKey = getResponderKey(request); final Responder responder; if (usingResponderKey(responderKey)) { responder = wrapWithFilters(responderKey, lookupResponder(responderKey)); } else if (resource.startsWith("files/") || resource.equals("files")) { responder = wrapWithFilters("files", new FileResponder()); } else if (StringUtils.isBlank(resource) || PathParser.parse(resource) != null) { responder = wrapWithFilters("wiki", new WikiPageResponder()); } else { String urlResponderKey=findMatchKeyByUrl(resource); if (urlResponderKey != null) { responder = wrapWithFilters("url", lookupResponder(urlResponderKey)); } else { responder = new NotFoundResponder(); } } return responder; }
Source:
public void afterPropertiesSet() { taskScheduler = registrationTaskScheduler(); }

Target:
public void afterPropertiesSet() { taskScheduler.afterPropertiesSet(); }
Source:
protected int extractMax(String typeCode, String fieldName, Connection conn) { int id = 0; PreparedStatement stat = null; ResultSet res = null; try { if (null != typeCode) { stat = conn.prepareStatement("SELECT MAX( ? ) FROM jpwebform_typeversions WHERE typecode = ?"); stat.setString(1, fieldName); stat.setString(2, typeCode); } else { stat = conn.prepareStatement("SELECT MAX( ? ) FROM jpwebform_typeversions"); stat.setString(1, fieldName); } res = stat.executeQuery(); res.next(); id = res.getInt(1); } catch (Throwable t) { _logger.error("Error extracting max id", t); throw new RuntimeException("Error extracting max id", t); } finally { closeDaoResources(res, stat); } return id; }

Target:
protected int extractMax(String typeCode, String fieldName, Connection conn) { int id = 0; PreparedStatement stat = null; ResultSet res = null; try { if (null != typeCode) { stat = conn.prepareStatement("SELECT MAX(fieldName) FROM jpwebform_typeversions WHERE typecode = ?"); stat.replace("fieldName", fieldName) stat.setString(1, typeCode); } else { stat = conn.prepareStatement("SELECT MAX(fieldName) FROM jpwebform_typeversions"); stat.replace("fieldName", fieldName) } res = stat.executeQuery(); res.next(); id = res.getInt(1); } catch (Throwable t) { _logger.error("Error extracting max id", t); throw new RuntimeException("Error extracting max id", t); } finally { closeDaoResources(res, stat); } return id; }
Source:
protected void execute(final RebaseOperation rebase) throws ExecutionException { final Repository repository = rebase.getRepository(); if (repository == null) return; final RebaseCommand.Operation operation = rebase.getOperation(); if (operation == Operation.BEGIN) { try { final org.eclipse.jgit.api.Status status = Git.wrap(repository) .status().call(); if (!status.isClean()) { handleUncommittedChanges(rebase, repository, status); return; } } catch (NoWorkTreeException e) { Activator.logError(e.getMessage(), e); } catch (GitAPIException e) { Activator.logError(e.getMessage(), e); } } startRebaseJob(rebase, repository, operation); }

Target:
protected void execute(final RebaseOperation rebase) throws ExecutionException { final Repository repository = rebase.getRepository(); if (repository == null) return; final RebaseCommand.Operation operation = rebase.getOperation(); if (operation == Operation.BEGIN) { IndexDiffData indexDiffData = org.eclipse.egit.core.Activator .getDefault().getIndexDiffCache() .getIndexDiffCacheEntry(repository).getIndexDiff(); List<String> files = new ArrayList<String>(); files.addAll(indexDiffData.getAdded()); files.addAll(indexDiffData.getChanged()); files.addAll(indexDiffData.getModified()); files.addAll(indexDiffData.getRemoved()); files.addAll(indexDiffData.getConflicting()); if (!files.isEmpty()) { handleUncommittedChanges(rebase, repository, files); return; } } startRebaseJob(rebase, repository, operation); }
Source:
public void notifyChanged(Notification notification) { super.notifyChanged(notification); Object object = notification.getNotifier(); NamedElement property = getUMLElement(); if (object == null || property == null) { return; } if (UMLPackage.eINSTANCE.getLiteralInteger_Value().equals(notification.getFeature())) { refreshDisplay(); } else if (UMLPackage.eINSTANCE.getLiteralUnlimitedNatural_Value().equals(notification.getFeature())) { refreshDisplay(); } if (object.equals(property)) { notifyNamedElementChanged(property, notification); } if (isMaskManagedAnnotation(object)) { refreshDisplay(); } if (isRemovedMaskManagedLabelAnnotation(object, notification)) { refreshDisplay(); } }

Target:
public void notifyChanged(Notification notification) { super.notifyChanged(notification); Object object = notification.getNotifier(); NamedElement property = getUMLElement(); Object feature = notification.getFeature(); if (object == null || property == null || feature == null) { return; } if (feature == UMLPackage.eINSTANCE.getLiteralInteger_Value()) { refreshDisplay(); } else if (feature == UMLPackage.eINSTANCE.getLiteralUnlimitedNatural_Value()) { refreshDisplay(); } if (object.equals(property)) { notifyNamedElementChanged(property, notification); } if (isMaskManagedAnnotation(object)) { refreshDisplay(); } if (isRemovedMaskManagedLabelAnnotation(object, notification)) { refreshDisplay(); } }
Source:
private Intent getClickIntentForAccount(Context context) { Account account = (Account) getAccount(context); if (K9.FOLDER_NONE.equals(account.getAutoExpandFolderName())) { return FolderList.actionHandleAccountIntent(context, account, false); } LocalSearch search = new LocalSearch(account.getAutoExpandFolderName()); search.addAllowedFolder(account.getAutoExpandFolderName()); search.addAccountUuid(account.getUuid()); return MessageList.intentDisplaySearch(context, search, false, true, true); }

Target:
private Intent getClickIntentForAccount(Context context) { Account account = Preferences.getPreferences(context).getAccount(accountUuid); if (K9.FOLDER_NONE.equals(account.getAutoExpandFolderName())) { return FolderList.actionHandleAccountIntent(context, account, false); } LocalSearch search = new LocalSearch(account.getAutoExpandFolderName()); search.addAllowedFolder(account.getAutoExpandFolderName()); search.addAccountUuid(account.getUuid()); return MessageList.intentDisplaySearch(context, search, false, true, true); }
Source:
public void logMetricsSize() { log.debug("corfu server metrics size " + MetricsUtils.sizeOf.deepSizeOf(ServerContext.getMetrics ())); }

Target:
public void logMetricsSize() { log.debug("corfu server metrics size {}.", MetricsUtils.sizeOf.deepSizeOf(ServerContext.getMetrics())); }
Source:
public FileOpenCloseEventListener(final Provider<EditorAgent> editorAgentProvider, final DeletedFilesController deletedFilesController, final EventBus eventBus) { Log.debug(getClass(), "Adding file event listener"); eventBus.addHandler(FileEvent.TYPE, new FileEvent.FileEventHandler() { @Override public void onFileOperation(FileEvent event) { final Path path = event.getFile().getLocation(); final EditorAgent editorAgent = editorAgentProvider.get(); switch (event.getOperationType()) { case OPEN: { if (editorAgent.getOpenedEditor(path) == null) { Log.info(getClass(), "Subscribe file for event handling"); processFileOpen(path); } break; } case CLOSE: { final EditorPartPresenter closingEditor = event.getEditorTab().getRelativeEditorPart(); final List<EditorPartPresenter> openedEditors = editorAgent.getOpenedEditors(); processFileClose(closingEditor, openedEditors, path); break; } } } private void processFileOpen(Path path) { eventBus.fireEvent(newFileTrackingStartEvent(path.toString())); } private void processFileClose(EditorPartPresenter closingEditor, List<EditorPartPresenter> openedEditors, Path path) { for (final EditorPartPresenter editor : openedEditors) { final Path editorFilePath = editor.getEditorInput().getFile().getLocation(); if (Objects.equals(path, editorFilePath) && closingEditor != editor) { return; } } eventBus.fireEvent(newFileTrackingStopEvent(path.toString())); } }); }

Target:
public FileOpenCloseEventListener(final Provider<EditorAgent> editorAgentProvider, final DeletedFilesController deletedFilesController, final EventBus eventBus) { Log.debug(getClass(), "Adding file event listener"); eventBus.addHandler(FileEvent.TYPE, new FileEvent.FileEventHandler() { @Override public void onFileOperation(FileEvent event) { final Path path = event.getFile().getLocation(); final EditorAgent editorAgent = editorAgentProvider.get(); switch (event.getOperationType()) { case OPEN: { if (editorAgent.getOpenedEditor(path) == null) { Log.debug(getClass(), "Subscribe file for event handling"); processFileOpen(path); } break; } case CLOSE: { final EditorPartPresenter closingEditor = event.getEditorTab().getRelativeEditorPart(); final List<EditorPartPresenter> openedEditors = editorAgent.getOpenedEditors(); processFileClose(closingEditor, openedEditors, path); break; } } } private void processFileOpen(Path path) { eventBus.fireEvent(newFileTrackingStartEvent(path.toString())); } private void processFileClose(EditorPartPresenter closingEditor, List<EditorPartPresenter> openedEditors, Path path) { for (final EditorPartPresenter editor : openedEditors) { final Path editorFilePath = editor.getEditorInput().getFile().getLocation(); if (Objects.equals(path, editorFilePath) && closingEditor != editor) { return; } } eventBus.fireEvent(newFileTrackingStopEvent(path.toString())); } }); }
Source:
public static double betaCdf( @SqlType(StandardTypes.DOUBLE) double a, @SqlType(StandardTypes.DOUBLE) double b, @SqlType(StandardTypes.DOUBLE) double value) { checkCondition(value >= 0 && value <= 1, INVALID_FUNCTION_ARGUMENT, "value must be 0 >= v >= 1"); checkCondition(a > 0 && b > 0, INVALID_FUNCTION_ARGUMENT, "a, b must be > 0"); BetaDistribution dist = new BetaDistribution(a, b); return dist.cumulativeProbability(value); }

Target:
public static double betaCdf( @SqlType(StandardTypes.DOUBLE) double a, @SqlType(StandardTypes.DOUBLE) double b, @SqlType(StandardTypes.DOUBLE) double value) { checkCondition(value >= 0 && value <= 1, INVALID_FUNCTION_ARGUMENT, "value must be in the interval [0, 1]"); checkCondition(a > 0, INVALID_FUNCTION_ARGUMENT, "a must be > 0"); checkCondition(b > 0, INVALID_FUNCTION_ARGUMENT, "b must be > 0"); BetaDistribution distribution = new BetaDistribution(null, a, b, BetaDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY); return distribution.cumulativeProbability(value); }
Source:
R apply(T t) throws Exception; default Function<T, R> orElseThrow() { return t -> { try { return apply(t); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }; }

Target:
R apply(T t) throws Exception; default Function<T, R> orElseThrow() { return t -> { try { return apply(t); } catch (Throwable e) { throw Exceptions.duck(e); } }; }
Source:
public void onResume() { super.onResume(); onPositionObserverUpdate(); new Thread(() -> controller.init()).start(); }

Target:
public void onResume() { super.onResume(); onPositionObserverUpdate(); controller.init(); }
Source:
public void setDefaultConfiguration() { Realm.removeDefaultConfiguration(); Realm.setDefaultConfiguration(defaultConfig); realm = Realm.getDefaultInstance(); assertEquals(realm.getPath(), defaultConfig.getPath()); }

Target:
public void setDefaultConfiguration() { Realm.setDefaultConfiguration(defaultConfig); realm = Realm.getDefaultInstance(); assertEquals(defaultConfig, realm.getConfiguration()); }
Source:
public Map<String, List<String>> getTopologyMap() { return getTopologyUnderDomain(new HashMap<>()); }

Target:
public Map<String, List<String>> getTopologyMap() { return getTopologyUnderDomain(Collections.emptyMap()); }
Source:
public String stripProtocolAndBranch(String uri) { return uri.replaceFirst("^[A-Za-z]+://([^@]+@)?", ""); }

Target:
public String stripProtocolAndBranch(String uri) { return protocolAndBranch.matcher(uri).replaceFirst(""); }
Source:
private String resolveProjectName(String artifactId, String owa) { if (artifactId != null) { return artifactId; } else if (projectType == ProjectType.OWA) { if (owa != null) { return adjustProjectNameIfPrefixMissing(owa, OpenmrsBintray.OPENMRS_OWA_PREFIX); } else { return askForBintrayProjectName(); } } else { return wizard.promptForValueIfMissing(artifactId, "artifactId"); } }

Target:
private String resolveProjectName(String artifactId, String owa) { if (StringUtils.isNotBlank(artifactId)) { return artifactId; } else if (ProjectType.OWA.equals(projectType)) { if (StringUtils.isNotBlank(owa)) { return adjustProjectNameIfPrefixMissing(owa, OpenmrsBintray.OPENMRS_OWA_PREFIX); } else { return askForBintrayProjectName(); } } else { return wizard.promptForValueIfMissing(artifactId, "artifactId"); } }
Source:
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException exception ) { String[] tokens = recognizer.getTokenNames(); final List<String> tokensAsList = Arrays.asList(tokens); final Iterator<Integer> tokenids = exception.getExpectedTokens().toList().iterator(); final StringBuilder expectedTokens = new StringBuilder(); while (tokenids.hasNext()) { expectedTokens.append(tokensAsList.get(tokenids.next())); if (!tokenids.hasNext()) { expectedTokens.append("."); break; } expectedTokens.append(", "); } final String errorTokens = expectedTokens.toString().replaceAll("'", ""); throw new QueryException("Wrong input at " + "'" + exception.getOffendingToken().getText() + "' at " + "Line " + line + " Char " + charPositionInLine + ", expected one of the following tokens " + errorTokens); }

Target:
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException exception ) { final ImmutableList<String> tokensAsList = ImmutableList.copyOf(recognizer.getTokenNames()); final Iterator<Integer> tokenids = exception.getExpectedTokens().toList().iterator(); final StringBuilder expectedTokens = new StringBuilder(); while (tokenids.hasNext()) { expectedTokens.append(tokensAsList.get(tokenids.next())); if (!tokenids.hasNext()) { expectedTokens.append("."); break; } expectedTokens.append(", "); } final String errorTokens = expectedTokens.toString().replaceAll("'", ""); throw new QueryException("Wrong input at " + "'" + exception.getOffendingToken().getText() + "' at " + "Line " + line + " Char " + charPositionInLine + ", expected one of the following tokens " + errorTokens); }
Source:
private void updateThreadFolderSetting() { if (ChanSettings.saveBoardFolder.get()) { threadFolderSetting.setEnabled(true); } else if (!ChanSettings.saveBoardFolder.get()) { if (ChanSettings.saveThreadFolder.get()) { threadFolderSetting.onClick(threadFolderSetting.view); } threadFolderSetting.setEnabled(false); ChanSettings.saveThreadFolder.set(false); } }

Target:
private void updateThreadFolderSetting() { if (ChanSettings.saveBoardFolder.get()) { threadFolderSetting.setEnabled(true); } else { if (ChanSettings.saveThreadFolder.get()) { threadFolderSetting.onClick(threadFolderSetting.view); } threadFolderSetting.setEnabled(false); ChanSettings.saveThreadFolder.set(false); } }
Source:
private static void enable(SingletonService service) { try { service.enable(); } catch (RuntimeException e) { e.printStackTrace(); } }

Target:
private static void enable(SingletonService service) { try { service.enable(); } catch (RuntimeException e) { log.error("Failed to enable singleton service ", e); } }
Source:
private String writePageHeader() { StringBuilder output = new StringBuilder(); String pageHeader = configPanel.getHeader(); if (pageHeader.isEmpty() == false) { output.append("<p style=\"text-align: center\">") .append(StringEscapeUtils.escapeHtml4(pageHeader)) .append("</p>\n"); } return output.toString(); }

Target:
private String writePageHeader() { StringBuilder output = new StringBuilder(); String pageHeader = configPanel.getHeader(); if (pageHeader.isEmpty() == false) { output.append("<div id=\"pageHeaderFooter\">") .append(StringEscapeUtils.escapeHtml4(pageHeader)) .append("</div>\n"); } return output.toString(); }
Source:
static public SAMFileHeader makeDefaultHeader(final SAMFileHeader.SortOrder sortOrder, final int contigLength, final boolean addReadGroup) { final List<SAMSequenceRecord> sequences = new ArrayList<>(); for (final String chrom : chroms) { final SAMSequenceRecord sequenceRecord = new SAMSequenceRecord(chrom, contigLength); sequences.add(sequenceRecord); } final SAMFileHeader header = new SAMFileHeader(); header.setSequenceDictionary(new SAMSequenceDictionary(sequences)); header.setSortOrder(sortOrder); if (addReadGroup) { final SAMReadGroupRecord readGroupRecord = new SAMReadGroupRecord(READ_GROUP_ID); readGroupRecord.setSample(SAMPLE); readGroupRecord.setPlatform("ILLUMINA"); final List<SAMReadGroupRecord> readGroups = new ArrayList<>(); readGroups.add(readGroupRecord); header.setReadGroups(readGroups); } return header; }

Target:
static public SAMFileHeader makeDefaultHeader(final SAMFileHeader.SortOrder sortOrder, final int contigLength, final boolean addReadGroup) { final List<SAMSequenceRecord> sequences = new ArrayList<>(); for (final String chrom : chroms) { final SAMSequenceRecord sequenceRecord = new SAMSequenceRecord(chrom, contigLength); sequences.add(sequenceRecord); } final SAMFileHeader header = new SAMFileHeader(); header.setSequenceDictionary(new SAMSequenceDictionary(sequences)); header.setSortOrder(sortOrder); if (addReadGroup) { final SAMReadGroupRecord readGroupRecord = new SAMReadGroupRecord(READ_GROUP_ID); readGroupRecord.setSample(SAMPLE); readGroupRecord.setPlatform(PlatformValue.ILLUMINA.name()); final List<SAMReadGroupRecord> readGroups = Collections.singletonList(readGroupRecord); header.setReadGroups(readGroups); } return header; }
Source:
public LoopbackExportDecoder(AdvertisedDataSource source) { super(source); if (m_rejectedDH != null) { m_rejs = Suppliers.memoize(new Supplier<CSVWriter>() { @Override public CSVWriter get() { String fileFN = String.format( "rejected-%d-%s.tsv", source.partitionId ); File rejectedFH = new File(m_rejectedDH, fileFN); LOG.warn("writing failed invocations parameters to " + rejectedFH); try { OutputStreamWriter osw = new OutputStreamWriter( new FileOutputStream(rejectedFH, false), "UTF-8"); CSVWriter wrtr = CSVWriter.getStrictTSVWriter(new BufferedWriter(osw, 4096 * 4)); m_wrote = true; return wrtr; } catch (UnsupportedEncodingException | FileNotFoundException e) { LOG.error("failed to create TSV writer for " + rejectedFH, e); throw new LoopbackExportException("failed to create TSV writer for %s", e, rejectedFH); } } }); } else { m_rejs = null; } final String tmpl = "yyyy-MM-dd'T'HH:mm:ss.SSS"; CSVWriterDecoder.Builder builder = new CSVWriterDecoder.Builder(); builder .dateFormatter(tmpl) .skipInternalFields(true) ; m_csvWriterDecoder = builder.build(); m_es = CoreUtils.getListeningSingleThreadExecutor( "Loopback Export decoder for partition " + source.partitionId, CoreUtils.MEDIUM_STACK_SIZE); m_user = getVoltDB().getCatalogContext().authSystem.getImporterUser(); m_invoker = getVoltDB().getClientInterface().getInternalConnectionHandler(); m_shouldContinue = (x) -> !m_es.isShutdown(); }

Target:
public LoopbackExportDecoder(AdvertisedDataSource source) { super(source); if (m_rejectedDH != null) { m_rejs = Suppliers.memoize(new Supplier<CSVWriter>() { @Override public CSVWriter get() { String fileFN = String.format( "rejected-%s-%d.tsv", source.tableName, source.partitionId ); File rejectedFH = new File(m_rejectedDH, fileFN); LOG.warn("writing failed invocations parameters to " + rejectedFH); try { OutputStreamWriter osw = new OutputStreamWriter( new FileOutputStream(rejectedFH, false), "UTF-8"); CSVWriter wrtr = CSVWriter.getStrictTSVWriter(new BufferedWriter(osw, 4096 * 4)); m_wrote = true; return wrtr; } catch (UnsupportedEncodingException | FileNotFoundException e) { LOG.error("failed to create TSV writer for " + rejectedFH, e); throw new LoopbackExportException("failed to create TSV writer for %s", e, rejectedFH); } } }); } else { m_rejs = null; } final String tmpl = "yyyy-MM-dd'T'HH:mm:ss.SSS"; CSVWriterDecoder.Builder builder = new CSVWriterDecoder.Builder(); builder .dateFormatter(tmpl) .skipInternalFields(true) ; m_csvWriterDecoder = builder.build(); m_es = CoreUtils.getListeningSingleThreadExecutor( "Loopback Export decoder for partition " + source.partitionId, CoreUtils.MEDIUM_STACK_SIZE); m_user = getVoltDB().getCatalogContext().authSystem.getImporterUser(); m_invoker = getVoltDB().getClientInterface().getInternalConnectionHandler(); m_shouldContinue = (x) -> !m_es.isShutdown(); }
Source:
public boolean shouldValidateBean(final Validator validator, final Class<?> clazz) { return types.computeIfAbsent(clazz, it -> validator.getConstraintsForClass(it).hasConstraints()); }

Target:
public boolean shouldValidateBean(final Validator validator, final Class<?> clazz) { return types.computeIfAbsent(clazz, it -> validator.getConstraintsForClass(it).isBeanConstrained()); }
Source:
public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("name"); description.addProperty("frequencyPerDay"); description.addProperty("retired"); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("name"); description.addProperty("frequencyPerDay"); description.addProperty("retired"); description.addProperty("concept", Representation.DEFAULT); description.addSelfLink(); return description; } return null; }

Target:
public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("name"); description.addProperty("frequencyPerDay"); description.addProperty("retired"); description.addProperty("concept", Representation.REF); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("name"); description.addProperty("frequencyPerDay"); description.addProperty("concept", Representation.DEFAULT); description.addProperty("retired"); description.addSelfLink(); description.addProperty("auditInfo", findMethod("getAuditInfo")); return description; } return null; }
Source:
public DataOutputStream getChunkDataOutputStream(int x, int z) { checkBounds(x, z); return new DataOutputStream(new BufferedOutputStream(new DeflaterOutputStream(new ChunkBuffer(x, z)))); }

Target:
public DataOutputStream getChunkDataOutputStream(int x, int z) { checkBounds(x, z); return new DataOutputStream(new BufferedOutputStream(new DeflaterOutputStream(new ChunkBuffer(x, z), new Deflater(), 2048))); }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; RowProcessingStream other = (RowProcessingStream) obj; if (_analysisJob == null) { if (other._analysisJob != null) return false; } else if (!_analysisJob.equals(other._analysisJob)) return false; if (_table == null) { if (other._table != null) return false; } else if (!_table.equals(other._table)) return false; return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || !(obj instanceof RowProcessingStream)) { return false; } final RowProcessingStream other = (RowProcessingStream) obj; return Objects.equals(_analysisJob, other._analysisJob) && Objects.equals(_table, other._table); }
Source:
public FinalizingFieldAccessPostAggregator decorate(final Map<String, AggregatorFactory> aggregators) { return new FinalizingFieldAccessPostAggregator(name, fieldName) { @Override public Object compute(Map<String, Object> combinedAggregators) { if (aggregators != null && aggregators.containsKey(fieldName)) { return aggregators.get(fieldName).finalizeComputation( combinedAggregators.get(fieldName) ); } else { return combinedAggregators.get(fieldName); } } }; }

Target:
public FinalizingFieldAccessPostAggregator decorate(final Map<String, AggregatorFactory> aggregators) { return new FinalizingFieldAccessPostAggregator(name, fieldName) { @Override public Comparator getComparator() { if (aggregators != null && aggregators.containsKey(fieldName)) { return aggregators.get(fieldName).getComparator(); } else { return Ordering.natural().nullsFirst(); } } @Override public Object compute(Map<String, Object> combinedAggregators) { if (aggregators != null && aggregators.containsKey(fieldName)) { return aggregators.get(fieldName).finalizeComputation( combinedAggregators.get(fieldName) ); } else { return combinedAggregators.get(fieldName); } } }; }
Source:
public Result apply(ProjectNode node, Captures captures, Context context) { N child = captures.get(targetCapture); Map<DereferenceExpression, VariableReferenceExpression> allDereferencesInProject = getDereferenceSymbolMap(node.getAssignments().getExpressions(), context, metadata, sqlParser); Set<VariableReferenceExpression> childSourceSymbols = child.getSources().stream().map(PlanNode::getOutputVariables).flatMap(Collection::stream).collect(toImmutableSet()); Map<DereferenceExpression, VariableReferenceExpression> pushdownDereferences = allDereferencesInProject.entrySet().stream() .filter(entry -> childSourceSymbols.contains(getBase(entry.getKey(), context.getVariableAllocator().getTypes()))) .collect(toImmutableMap(Map.Entry::getKey, Map.Entry::getValue)); if (pushdownDereferences.isEmpty()) { return Result.empty(); } Result result = pushDownDereferences(context, child, HashBiMap.create(pushdownDereferences)); if (result.isEmpty()) { return Result.empty(); } Assignments.Builder builder = Assignments.builder(); for (Map.Entry<VariableReferenceExpression, RowExpression> entry : node.getAssignments().entrySet()) { if (OriginalExpressionUtils.isExpression(entry.getValue())) { builder.put(entry.getKey(), castToRowExpression(ExpressionTreeRewriter.rewriteWith(new DereferenceReplacer(pushdownDereferences), castToExpression(entry.getValue())))); } else { builder.put(entry.getKey(), entry.getValue()); } } return Result.ofPlanNode(new ProjectNode(context.getIdAllocator().getNextId(), result.getTransformedPlan().get(), builder.build())); }

Target:
public Result apply(ProjectNode node, Captures captures, Context context) { N child = captures.get(targetCapture); Map<DereferenceExpression, VariableReferenceExpression> allDereferencesInProject = getDereferenceSymbolMap(node.getAssignments().getExpressions(), context, metadata, sqlParser); Set<VariableReferenceExpression> childSourceSymbols = child.getSources().stream() .map(PlanNode::getOutputVariables).flatMap(Collection::stream) .collect(toImmutableSet()); Map<DereferenceExpression, VariableReferenceExpression> pushdownDereferences = allDereferencesInProject.entrySet().stream() .filter(entry -> childSourceSymbols.contains(getBase(entry.getKey(), context.getVariableAllocator().getTypes()))) .collect(toImmutableMap(Map.Entry::getKey, Map.Entry::getValue)); if (pushdownDereferences.isEmpty()) { return Result.empty(); } Result result = pushDownDereferences(context, child, HashBiMap.create(pushdownDereferences)); if (result.isEmpty()) { return Result.empty(); } Assignments.Builder builder = Assignments.builder(); for (Map.Entry<VariableReferenceExpression, RowExpression> entry : node.getAssignments().entrySet()) { if (OriginalExpressionUtils.isExpression(entry.getValue())) { builder.put(entry.getKey(), replaceDereferences(entry.getValue(), pushdownDereferences)); } else { builder.put(entry.getKey(), entry.getValue()); } } return Result.ofPlanNode(new ProjectNode(context.getIdAllocator().getNextId(), result.getTransformedPlan().get(), builder.build())); }
Source:
public void VisualEditorMultiplePublish_001() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userName, credentials.password, wikiURL); VisualEditorPageObject ve = base.openNewArticleEditModeVisual(wikiURL); String targetText = PageContent.articleText; String articleName = PageContent.articleNamePrefix + ve.getTimeStamp(); ve.gotoArticleEditModeVisual(wikiURL,articleName); ve.typeTextArea(PageContent.articleText); VisualEditorSaveChangesDialog save = ve.clickPublishButton(); ArticlePageObject article = save.savePage(); article.verifyFormattingFromVE(Formatting.PARAGRAPH, targetText); targetText = PageContent.articleTextEdit + targetText; ve.gotoArticleEditModeVisual(wikiURL,articleName); ve.typeTextArea(PageContent.articleTextEdit); save = ve.clickPublishButton(); article = save.savePage(); article.verifyFormattingFromVE(Formatting.PARAGRAPH, targetText); targetText = PageContent.articleTextSecondEdit + targetText; ve.gotoArticleEditModeVisual(wikiURL,articleName); ve.typeTextArea(PageContent.articleTextSecondEdit); save = ve.clickPublishButton(); article = save.savePage(); article.verifyFormattingFromVE(Formatting.PARAGRAPH, targetText); }

Target:
public void VisualEditorMultiplePublish_001() { String targetText = PageContent.articleText; String articleName = base.getNameForArticle(); article = base.openArticleByName(wikiURL, articleName); ve = article.navigateToArticleEditModeVisual(wikiURL, articleName); article = ve.clickVEEditAndPublish(wikiURL, articleName, targetText); article.verifyFormattingFromVE(Formatting.PARAGRAPH, targetText); targetText = PageContent.articleTextEdit + targetText; ve = article.navigateToArticleEditModeVisual(wikiURL, articleName); article = ve.clickVEEditAndPublish(wikiURL, articleName, PageContent.articleTextEdit); article.verifyFormattingFromVE(Formatting.PARAGRAPH, targetText); targetText = PageContent.articleTextSecondEdit + targetText; ve = article.navigateToArticleEditModeVisual(wikiURL, articleName); article = ve.clickVEEditAndPublish(wikiURL, articleName, PageContent.articleTextSecondEdit); article.verifyFormattingFromVE(Formatting.PARAGRAPH, targetText); }
Source:
public RevCommit cherryPick(AnyObjectId id) throws Exception { RevCommit commit = pool.parseCommit(id); pool.parseBody(commit); if (commit.getParentCount() != 1) throw new IOException(String.format( "Expected 1 parent for %s, found: %s", id.name(), Arrays.asList(commit.getParents()))); RevCommit parent = commit.getParent(0); pool.parseHeaders(parent); Ref headRef = db.getRef(Constants.HEAD); if (headRef == null) throw new IOException("Missing HEAD"); RevCommit head = pool.parseCommit(headRef.getObjectId()); ThreeWayMerger merger = MergeStrategy.RECURSIVE.newMerger(db, true); merger.setBase(parent.getTree()); if (merger.merge(head, commit)) { if (AnyObjectId.equals(head.getTree(), merger.getResultTreeId())) return null; tick(1); org.eclipse.jgit.lib.CommitBuilder b = new org.eclipse.jgit.lib.CommitBuilder(); b.setParentId(head); b.setTreeId(merger.getResultTreeId()); b.setAuthor(commit.getAuthorIdent()); b.setCommitter(new PersonIdent(commit.getCommitterIdent(), new Date(now))); b.setMessage(commit.getFullMessage()); ObjectId result; try (ObjectInserter ins = inserter) { result = ins.insert(b); ins.flush(); } update(Constants.HEAD, result); return pool.parseCommit(result); } else { throw new IOException("Merge conflict"); } }

Target:
public RevCommit cherryPick(AnyObjectId id) throws Exception { RevCommit commit = pool.parseCommit(id); pool.parseBody(commit); if (commit.getParentCount() != 1) throw new IOException(String.format( "Expected 1 parent for %s, found: %s", id.name(), Arrays.asList(commit.getParents()))); RevCommit parent = commit.getParent(0); pool.parseHeaders(parent); Ref headRef = db.getRef(Constants.HEAD); if (headRef == null) throw new IOException("Missing HEAD"); RevCommit head = pool.parseCommit(headRef.getObjectId()); ThreeWayMerger merger = MergeStrategy.RECURSIVE.newMerger(db, true); merger.setBase(parent.getTree()); if (merger.merge(head, commit)) { if (AnyObjectId.equals(head.getTree(), merger.getResultTreeId())) return null; tick(1); org.eclipse.jgit.lib.CommitBuilder b = new org.eclipse.jgit.lib.CommitBuilder(); b.setParentId(head); b.setTreeId(merger.getResultTreeId()); b.setAuthor(commit.getAuthorIdent()); b.setCommitter(new PersonIdent(defaultCommitter, new Date(now))); b.setMessage(commit.getFullMessage()); ObjectId result; try (ObjectInserter ins = inserter) { result = ins.insert(b); ins.flush(); } update(Constants.HEAD, result); return pool.parseCommit(result); } else { throw new IOException("Merge conflict"); } }
Source:
public void validateArguments(List<Expr> args) { if (!(args.size() > 0)) { throw new IAE("Function[%s] needs at least 1 argument", name()); } }

Target:
public void validateArguments(List<Expr> args) { if (args.isEmpty()) { throw new IAE("Function[%s] needs at least 1 argument", name()); } }