auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void executeQueryCommand() { List<OvfEntityData> entityList = unregisteredOVFDataDao.getByEntityIdAndStorageDomain(getParameters().getEntityId(), getParameters().getStorageDomainId()); VmTemplate vmTemplate = null; if (!entityList.isEmpty()) { OvfEntityData ovfEntityData = entityList.get(0); try { vmTemplate = ovfHelper.readVmTemplateFromOvf(ovfEntityData.getOvfData()).getVmTemplate(); } catch (OvfReaderException e) { log.debug("failed to parse a given ovf configuration: \n" + ovfEntityData.getOvfData(), e); getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); } } getQueryReturnValue().setSucceeded(true); getQueryReturnValue().setReturnValue(vmTemplate); }

Target:
protected void executeQueryCommand() { List<OvfEntityData> entityList = unregisteredOVFDataDao.getByEntityIdAndStorageDomain(getParameters().getEntityId(), getParameters().getStorageDomainId()); VmTemplate vmTemplate = null; if (!entityList.isEmpty()) { OvfEntityData ovfEntityData = entityList.get(0); try { vmTemplate = ovfHelper.readVmTemplateFromOvf(ovfEntityData.getOvfData()).getVmTemplate(); } catch (OvfReaderException e) { log.debug("Failed to parse a given ovf configuration: \n" + ovfEntityData.getOvfData(), e); getQueryReturnValue().setExceptionString("Failed to parse a given ovf configuration: " + e.getMessage()); } } getQueryReturnValue().setSucceeded(true); getQueryReturnValue().setReturnValue(vmTemplate); }
Source:
public void testAlterColumns() { String tableName = randomUUID().toString().toUpperCase(Locale.getDefault()); SchemaTableName schemaTableName = new SchemaTableName("exa_ple", tableName); List<ColumnMetadata> expectedColumns = ImmutableList.of( new ColumnMetadata("columnA", BigintType.BIGINT, null, null, false)); jdbcClient.createTable(new ConnectorTableMetadata(schemaTableName, expectedColumns)); JdbcTableHandle tableHandle = jdbcClient.getTableHandle(schemaTableName); assertEquals(tableHandle.getTableName(), tableName); assertEquals(jdbcClient.getColumns(session, tableHandle), ImmutableList.of( new JdbcColumnHandle(CONNECTOR_ID, "COLUMNA", JDBC_BIGINT, BigintType.BIGINT))); jdbcClient.addColumn(tableHandle, new ColumnMetadata("columnB", BigintType.BIGINT, null, null, false)); assertEquals(jdbcClient.getColumns(session, tableHandle), ImmutableList.of( new JdbcColumnHandle(CONNECTOR_ID, "COLUMNA", JDBC_BIGINT, BigintType.BIGINT), new JdbcColumnHandle(CONNECTOR_ID, "COLUMNB", JDBC_BIGINT, BigintType.BIGINT))); jdbcClient.dropColumn(tableHandle, new JdbcColumnHandle(CONNECTOR_ID, "COLUMNB", JDBC_BIGINT, BigintType.BIGINT)); assertEquals(jdbcClient.getColumns(session, tableHandle), ImmutableList.of( new JdbcColumnHandle(CONNECTOR_ID, "COLUMNA", JDBC_BIGINT, BigintType.BIGINT))); }

Target:
public void testAlterColumns() { String tableName = randomUUID().toString().toUpperCase(ENGLISH); SchemaTableName schemaTableName = new SchemaTableName("example", tableName); List<ColumnMetadata> expectedColumns = ImmutableList.of( new ColumnMetadata("columnA", BigintType.BIGINT, null, null, false)); jdbcClient.createTable(new ConnectorTableMetadata(schemaTableName, expectedColumns)); JdbcTableHandle tableHandle = jdbcClient.getTableHandle(schemaTableName); try { assertEquals(tableHandle.getTableName(), tableName); assertEquals(jdbcClient.getColumns(session, tableHandle), ImmutableList.of( new JdbcColumnHandle(CONNECTOR_ID, "COLUMNA", JDBC_BIGINT, BigintType.BIGINT, true))); jdbcClient.addColumn(tableHandle, new ColumnMetadata("columnB", DoubleType.DOUBLE, null, null, false)); assertEquals(jdbcClient.getColumns(session, tableHandle), ImmutableList.of( new JdbcColumnHandle(CONNECTOR_ID, "COLUMNA", JDBC_BIGINT, BigintType.BIGINT, true), new JdbcColumnHandle(CONNECTOR_ID, "COLUMNB", JDBC_DOUBLE, DoubleType.DOUBLE, true))); jdbcClient.dropColumn(tableHandle, new JdbcColumnHandle(CONNECTOR_ID, "COLUMNB", JDBC_BIGINT, BigintType.BIGINT, true)); assertEquals(jdbcClient.getColumns(session, tableHandle), ImmutableList.of( new JdbcColumnHandle(CONNECTOR_ID, "COLUMNA", JDBC_BIGINT, BigintType.BIGINT, true))); } finally { jdbcClient.dropTable(tableHandle); } }
Source:
public String getIconFileName() { return Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER) ? "/plugin/selenium/24x24/selenium.png" : null; }

Target:
public String getIconFileName() { return Jenkins.getInstance().hasPermission(getRequiredPermission()) ? "/plugin/selenium/24x24/selenium.png" : null; }
Source:
public void testSecondInputCheckAllWithFileMapping() throws IOException { File metrics = File.createTempFile("Fingerprinting", "test.crosscheck_metrics"); metrics.deleteOnExit(); final List<String> args = new ArrayList<>(); args.add("INPUT=" + NA12891_named_NA12892_r1.getAbsolutePath()); args.add("SECOND_INPUT=" + NA12891_r2.getAbsolutePath()); final File map = File.createTempFile("map", ".txt"); map.deleteOnExit(); tabbedWrite(map, Arrays.asList(Collections.singletonList("NA12891"), Collections.singletonList(NA12891_named_NA12892_r1.getAbsolutePath()))); args.add("OUTPUT=" + metrics.getAbsolutePath()); args.add("HAPLOTYPE_MAP=" + HAPLOTYPE_MAP); args.add("LOD_THRESHOLD=" + -1.0); args.add("CROSSCHECK_BY=SAMPLE"); args.add("CROSSCHECK_MODE=CHECK_ALL_OTHERS"); args.add("INPUT_SAMPLE_FILE_MAP=" + map); final int expectedRetVal = 0; final int numberOfSamples1 = 1; final int numberOfSamples2 = 1; boolean ExpectAllMatch = false; doTest(args.toArray(new String[0]), metrics, expectedRetVal, numberOfSamples1 * numberOfSamples2, CrosscheckMetric.DataType.SAMPLE, ExpectAllMatch); }

Target:
public void testSecondInputCheckAllWithFileMapping() throws IOException { File metrics = File.createTempFile("Fingerprinting", "test.crosscheck_metrics"); metrics.deleteOnExit(); final List<String> args = new ArrayList<>(); args.add("INPUT=" + NA12891_named_NA12892_r1.getAbsolutePath()); args.add("SECOND_INPUT=" + NA12891_r2.getAbsolutePath()); final Path map = File.createTempFile("map", ".txt").toPath(); IOUtil.deleteOnExit(map); tabbedWrite(map, Arrays.asList(Collections.singletonList("NA12891"), Collections.singletonList(NA12891_named_NA12892_r1.getAbsolutePath()))); args.add("OUTPUT=" + metrics.getAbsolutePath()); args.add("HAPLOTYPE_MAP=" + HAPLOTYPE_MAP); args.add("LOD_THRESHOLD=" + -1.0); args.add("CROSSCHECK_BY=SAMPLE"); args.add("CROSSCHECK_MODE=CHECK_ALL_OTHERS"); args.add("INPUT_SAMPLE_FILE_MAP=" + map); final int expectedRetVal = 0; final int numberOfSamples1 = 1; final int numberOfSamples2 = 1; boolean ExpectAllMatch = false; doTest(args.toArray(new String[0]), metrics, expectedRetVal, numberOfSamples1 * numberOfSamples2, CrosscheckMetric.DataType.SAMPLE, ExpectAllMatch); }
Source:
private synchronized PackIndex idx() throws IOException { if (loadedIdx == null) { if (invalid) throw new PackInvalidException(getPackFile()); try { final PackIndex idx = PackIndex.open(packFile.create(INDEX)); if (packChecksum == null) { packChecksum = idx.packChecksum; } else if (!Arrays.equals(packChecksum, idx.packChecksum)) { throw new PackMismatchException(MessageFormat.format( JGitText.get().packChecksumMismatch, packFile.getPath())); } loadedIdx = idx; } catch (InterruptedIOException e) { throw e; } catch (IOException e) { invalid = true; throw e; } } return loadedIdx; }

Target:
private synchronized PackIndex idx() throws IOException { if (loadedIdx == null) { if (invalid) throw new PackInvalidException(packFileName); try { final PackIndex idx = PackIndex.open(packFileName.create(INDEX)); if (packChecksum == null) { packChecksum = idx.packChecksum; } else if (!Arrays.equals(packChecksum, idx.packChecksum)) { throw new PackMismatchException(MessageFormat.format( JGitText.get().packChecksumMismatch, packFileName.getPath())); } loadedIdx = idx; } catch (InterruptedIOException e) { throw e; } catch (IOException e) { invalid = true; throw e; } } return loadedIdx; }
Source:
public String showAddDialogue() { if (addDialog == null) { addDialog = new DialogAddRegex(owner, this.getRegexes()); addDialog.pack(); } addDialog.setVisible(true); String regex = addDialog.getRegex(); addDialog.clear(); return regex; }

Target:
public String showAddDialogue() { if (addDialog == null) { addDialog = new DialogAddRegex(owner); addDialog.pack(); } addDialog.setRegexes(this.getRegexes()); addDialog.setVisible(true); String regex = addDialog.getRegex(); addDialog.clear(); return regex; }
Source:
public void safeExecute(Shell shell) { ConfigHelper helper; String titleText; if (canWrite) { helper = new EditComponentHelper(shell, SERVER); titleText = EDIT_TITLE; } else { helper = new ViewComponentHelper(shell); titleText = VIEW_TITLE; } ConfigSelectionDialog selectionDialog = new ConfigSelectionDialog(shell, titleText, SERVER.componentsInfo().getValue(), false, true); if (selectionDialog.open() == Window.OK) { String configName = selectionDialog.selectedConfig(); helper.createDialog(configName, false); } }

Target:
public void safeExecute(Shell shell) { ConfigHelper helper; String titleText; if (canWrite) { helper = new EditComponentHelper(shell, SERVER); titleText = editTitle; } else { helper = new ViewComponentHelper(shell); titleText = viewTitle; } ConfigSelectionDialog selectionDialog = new ConfigSelectionDialog(shell, titleText, SERVER.componentsInfo().getValue(), true, true); if (selectionDialog.open() == Window.OK) { String configName = selectionDialog.selectedConfig(); helper.createDialog(configName, false); } }
Source:
public void testListVolumesInDetail() { Set<? extends Volume> volumes = volumeApi.listInDetail().toSet(); assertNotNull(volumes); boolean foundIt = false; for (Volume vol : volumes) { Volume details = volumeApi.get(vol.getId()); assertNotNull(details); assertNotNull(details.getId()); assertNotNull(details.getCreated()); assertTrue(details.getSize() > -1); assertEquals(details.getId(), vol.getId()); assertEquals(details.getSize(), vol.getSize()); assertEquals(details.getName(), vol.getName()); assertEquals(details.getDescription(), vol.getDescription()); assertEquals(details.getCreated(), vol.getCreated()); assertEquals(details.getTenantId(), vol.getTenantId()); if (Objects.equal(details.getId(), testVolume.getId())) { foundIt = true; } } assertTrue(foundIt, "Failed to find the volume we previously created in listInDetail() response"); }

Target:
public void testListVolumesInDetail() { Set<? extends Volume> volumes = volumeApi.listInDetail().toSet(); assertNotNull(volumes); boolean foundIt = false; for (Volume vol : volumes) { Volume details = volumeApi.get(vol.getId()); assertNotNull(details); assertNotNull(details.getId()); assertNotNull(details.getCreated()); assertTrue(details.getSize() > -1); assertEquals(details.getId(), vol.getId()); assertEquals(details.getSize(), vol.getSize()); assertEquals(details.getName(), vol.getName()); assertEquals(details.getDescription(), vol.getDescription()); assertEquals(details.getCreated(), vol.getCreated()); assertEquals(details.getTenantId(), vol.getTenantId()); if (Objects.equal(details.getId(), testVolume.getId())) { foundIt = true; break; } } assertTrue(foundIt, "Failed to find the volume we previously created in listInDetail() response"); }
Source:
private ArrayList<Comment> fetchAllComments(ArticleTable article) { return (ArrayList<Comment>) hibernateTemplate.find("FROM Comment WHERE articleId = ?", article.getArticleId()); }

Target:
private List<Comment> fetchAllComments(ArticleTable article) { return (ArrayList<Comment>) hibernateTemplate.find("FROM Comment WHERE articleId = ?", article.getArticleId()); }
Source:
public void onFeedShareImage(final FeaturedImageCard card) { new ImagePipelineBitmapGetter(this, card.baseImage().thumbnail().source().toString()){ @Override public void onSuccess(@Nullable Bitmap bitmap) { if (bitmap != null) { ShareUtil.shareImage(MainActivity.this, bitmap, new java.io.File(card.baseImage().thumbnail().source().toString()).getName(), getString(R.string.feed_featured_image_share_subject) + " | " + DateUtil.getFeedCardDateString(card.date().baseCalendar()), card.baseImage().image().source().toString()); } else { FeedbackUtil.showMessage(MainActivity.this, getString(R.string.gallery_share_error, card.baseImage().title())); } } }.get(); }

Target:
public void onFeedShareImage(final FeaturedImageCard card) { final String thumbUrl = card.baseImage().thumbnail().source().toString(); final String fullSizeUrl = card.baseImage().image().source().toString(); new ImagePipelineBitmapGetter(this, thumbUrl){ @Override public void onSuccess(@Nullable Bitmap bitmap) { if (bitmap != null) { ShareUtil.shareImage(MainActivity.this, bitmap, new File(thumbUrl).getName(), getString(R.string.feed_featured_image_share_subject) + " | " + DateUtil.getFeedCardDateString(card.date().baseCalendar()), fullSizeUrl); } else { FeedbackUtil.showMessage(MainActivity.this, getString(R.string.gallery_share_error, card.baseImage().title())); } } }.get(); }
Source:
private void sendWebhookAlert(AbstractJobAlert jobAlert, String alertLink, String reason, Map<String, String> errors) { try { byte[] body = objectMapper.writeValueAsBytes(getWebhookObject(spawn, jobAlert, alertLink, reason, errors)); HttpResponse response = HttpUtil.httpPost(jobAlert.webhookURL, ContentType.APPLICATION_JSON.getMimeType(), body, 5_000); if (response.getStatus() / 100 != 2) { log.error("bad status code received for webhook alert for alert {}", jobAlert.alertId); } } catch (IOException ex) { log.error("unable to send webhook alert for alert {}", jobAlert.alertId, ex); } }

Target:
private void sendWebhookAlert(AbstractJobAlert jobAlert, String alertLink, String reason, Map<String, String> errors) { try { byte[] body = objectMapper.writeValueAsBytes(getWebhookObject(spawn, jobAlert, alertLink, reason, errors)); HttpResponse response = HttpUtil.httpPost(jobAlert.webhookURL, ContentType.APPLICATION_JSON.getMimeType(), body, 5_000); if (response.getStatus() >= 300) { log.error("non-200 status code received for webhook alert for alert {}", jobAlert.alertId); } } catch (IOException ex) { log.error("unable to send webhook alert for alert {}", jobAlert.alertId, ex); } }
Source:
public ThingUID getThingUID(ServiceInfo service) { if (service.getApplication().contains("dssweb")) { hostAdress = service.getName() + "." + service.getDomain() + "."; DsAPI digitalSTROMClient = new DsAPIImpl(hostAdress, Config.DEFAULT_CONNECTION_TIMEOUT, Config.DEFAULT_READ_TIMEOUT); dsid = digitalSTROMClient.getDSID("123"); if (dsid != null) { return new ThingUID(DigitalSTROMBindingConstants.THING_TYPE_DSS_BRIDGE, dsid); } else { return new ThingUID(DigitalSTROMBindingConstants.THING_TYPE_DSS_BRIDGE, "1"); } } return null; }

Target:
public ThingUID getThingUID(ServiceInfo service) { if (service.getApplication().contains("dssweb")) { String hostAddress = service.getName() + "." + service.getDomain() + "."; DsAPI digitalSTROMClient = new DsAPIImpl(hostAddress, Config.DEFAULT_CONNECTION_TIMEOUT, Config.DEFAULT_READ_TIMEOUT, true); String dsid = digitalSTROMClient.getDSID("123"); if (dsid != null) { return new ThingUID(DigitalSTROMBindingConstants.THING_TYPE_DSS_BRIDGE, dsid); } else { logger.error("Can't get server dSID to generate thing UID. Please add the server manually."); } } return null; }
Source:
protected StripeRequest(GatewayAccountEntity gatewayAccount, String idempotencyKey, StripeGatewayConfig stripeGatewayConfig) { if (gatewayAccount == null) { throw new IllegalArgumentException("Cannot create StripeRequest without a gateway account"); } String stripeConnectAccountId = gatewayAccount.getCredentials().get("stripe_account_id"); if (stripeConnectAccountId == null) { throw new IllegalArgumentException("Cannot create StripeRequest with a gateway account with out a stripe account id set"); } this.gatewayAccount = gatewayAccount; this.idempotencyKey = idempotencyKey; this.stripeGatewayConfig = stripeGatewayConfig; this.stripeConnectAccountId = stripeConnectAccountId; }

Target:
protected StripeRequest(GatewayAccountEntity gatewayAccount, String idempotencyKey, StripeGatewayConfig stripeGatewayConfig) { if (gatewayAccount == null) { throw new IllegalArgumentException("Cannot create StripeRequest without a gateway account"); } String stripeAccountId = gatewayAccount.getCredentials().get("stripe_account_id"); if (stripeAccountId == null) { throw new IllegalArgumentException("Cannot create StripeRequest with a gateway account with out a stripe account id set"); } this.gatewayAccount = gatewayAccount; this.idempotencyKey = idempotencyKey; this.stripeGatewayConfig = stripeGatewayConfig; this.stripeConnectAccountId = stripeAccountId; }
Source:
public long createSecretContent(long secretId, String encryptedContent, String hmac, String creator, Map<String, String> metadata, long expiry, long now) { SecretsContentRecord r = dslContext.newRecord(SECRETS_CONTENT); String jsonMetadata; try { jsonMetadata = mapper.writeValueAsString(metadata); } catch (JsonProcessingException e) { throw Throwables.propagate(e); } byte[] generateIdBytes = new byte[8]; random.nextBytes(generateIdBytes); ByteBuffer generateIdByteBuffer = ByteBuffer.wrap(generateIdBytes); long generatedId = generateIdByteBuffer.getLong(); String rowHmac = cryptographer.computeRowHmac( SECRETS_CONTENT.getName(), encryptedContent, generatedId); r.setId(generatedId); r.setSecretid(secretId); r.setEncryptedContent(encryptedContent); r.setContentHmac(hmac); r.setCreatedby(creator); r.setCreatedat(now); r.setUpdatedby(creator); r.setUpdatedat(now); r.setMetadata(jsonMetadata); r.setExpiry(expiry); r.setRowHmac(rowHmac); r.store(); pruneOldContents(secretId); return r.getId(); }

Target:
public long createSecretContent(long secretId, String encryptedContent, String hmac, String creator, Map<String, String> metadata, long expiry, long now) { SecretsContentRecord r = dslContext.newRecord(SECRETS_CONTENT); String jsonMetadata; try { jsonMetadata = mapper.writeValueAsString(metadata); } catch (JsonProcessingException e) { throw Throwables.propagate(e); } long generatedId = rowHmacGenerator.getNextLongSecure(); String rowHmac = rowHmacGenerator.computeRowHmac( SECRETS_CONTENT.getName(), encryptedContent, generatedId); r.setId(generatedId); r.setSecretid(secretId); r.setEncryptedContent(encryptedContent); r.setContentHmac(hmac); r.setCreatedby(creator); r.setCreatedat(now); r.setUpdatedby(creator); r.setUpdatedat(now); r.setMetadata(jsonMetadata); r.setExpiry(expiry); r.setRowHmac(rowHmac); r.store(); pruneOldContents(secretId); return r.getId(); }
Source:
public void testExecuteQueryGetUnregisteredTemplate() throws OvfReaderException { setUpTemplate(); setUpQueryEntities(); getQuery().executeQueryCommand(); @SuppressWarnings("unchecked") VmTemplate result = getQuery().getQueryReturnValue().getReturnValue(); assertEquals(VmTemplateReturnForOvf, result, "Wrong Templates entity in result"); }

Target:
public void testExecuteQueryGetUnregisteredTemplate() throws OvfReaderException { setUpTemplate(); setUpQueryEntities(); getQuery().executeQueryCommand(); @SuppressWarnings("unchecked") VmTemplate result = getQuery().getQueryReturnValue().getReturnValue(); assertEquals(VmTemplateReturnForOvf, result, "Wrong Templates entity"); }
Source:
private void writeAnswer( Sheet sheet, Row row, int startColumn, QuestionDto questionDto, String value, boolean useQuestionId) { assert value != null; value = value.trim(); List<String> cells = new ArrayList<>(); QuestionType questionType = questionDto.getQuestionType(); Long questionId = questionDto.getKeyId(); switch (questionType) { case DATE: cells.add(dateCellValue(value, questionId)); break; case PHOTO: cells.add(photoCellValue(value, imagePrefix)); break; case GEO: cells.addAll(geoCellValues(value)); break; case CASCADE: cells.addAll(cascadeCellValues(value, useQuestionId, questionDto.getLevelNames() .size())); break; case OPTION: cells.add(optionCellValue(value)); break; default: cells.add(sanitize(value)); break; } int col = startColumn; for (String cellValue : cells) { if (questionType == QuestionType.NUMBER) { createCell(row, col, cellValue, null, Cell.CELL_TYPE_NUMERIC); } else { createCell(row, col, cellValue); } col++; } }

Target:
private void writeAnswer( Sheet sheet, Row row, int startColumn, QuestionDto questionDto, String value, boolean useQuestionId) { assert value != null; List<String> cells = new ArrayList<>(); QuestionType questionType = questionDto.getQuestionType(); Long questionId = questionDto.getKeyId(); switch (questionType) { case DATE: cells.add(dateCellValue(value, questionId)); break; case PHOTO: cells.add(photoCellValue(value, imagePrefix)); break; case GEO: cells.addAll(geoCellValues(value)); break; case CASCADE: cells.addAll(cascadeCellValues(value, useQuestionId, questionDto.getLevelNames() .size())); break; case OPTION: cells.add(optionCellValue(value)); break; default: cells.add(sanitize(value)); break; } int col = startColumn; for (String cellValue : cells) { if (questionType == QuestionType.NUMBER) { createCell(row, col, cellValue, null, Cell.CELL_TYPE_NUMERIC); } else { createCell(row, col, cellValue); } col++; } }
Source:
public void testPresent_combatDamageResolvesLethalityUsingPower() { addCard(Zone.BATTLEFIELD, playerA, "Zilortha, Strength Incarnate"); addCard(Zone.BATTLEFIELD, playerA, "Savai Sabertooth"); addCard(Zone.BATTLEFIELD, playerB, "Drannith Healer"); attack(1, playerA, "Savai Sabertooth"); block(1, playerB, "Drannith Healer", "Savai Sabertooth"); execute(); assertGraveyardCount(playerA, "Savai Sabertooth", 0); assertGraveyardCount(playerB, "Drannith Healer", 1); }

Target:
public void testPresent_combatDamageResolvesLethalityUsingPower() { addCard(Zone.BATTLEFIELD, playerA, "Zilortha, Strength Incarnate"); addCard(Zone.BATTLEFIELD, playerA, "Savai Sabertooth"); addCard(Zone.BATTLEFIELD, playerB, "Drannith Healer"); attack(1, playerA, "Savai Sabertooth"); block(1, playerB, "Drannith Healer", "Savai Sabertooth"); setStrictChooseMode(true); setStopAt(1, PhaseStep.END_COMBAT); execute(); assertAllCommandsUsed(); assertGraveyardCount(playerA, "Savai Sabertooth", 0); assertGraveyardCount(playerB, "Drannith Healer", 1); }
Source:
public static String machineName(Pod pod, Container container) { final Map<String, String> annotations = pod.getMetadata().getAnnotations(); String machineName; final String containerName = container.getName(); if (annotations != null && (machineName = annotations.get(format(MACHINE_NAME_ANNOTATION_FMT, containerName))) != null) { return machineName; } final Map<String, String> labels = pod.getMetadata().getLabels(); if (labels != null && (machineName = labels.get(CHE_ORIGINAL_NAME_LABEL)) != null) { return machineName + '/' + containerName; } return pod.getMetadata().getName() + '/' + containerName; }

Target:
public static String machineName(Pod pod, Container container) { final Map<String, String> annotations = pod.getMetadata().getAnnotations(); final String machineName; final String containerName = container.getName(); if (annotations != null && (machineName = annotations.get(format(MACHINE_NAME_ANNOTATION_FMT, containerName))) != null) { return machineName; } final String originalPodName; final Map<String, String> labels = pod.getMetadata().getLabels(); if (labels != null && (originalPodName = labels.get(CHE_ORIGINAL_NAME_LABEL)) != null) { return originalPodName + '/' + containerName; } return pod.getMetadata().getName() + '/' + containerName; }
Source:
public TestingHiveOrcAggregatedMemoryContext() { this.delegate = newSimpleAggregatedMemoryContext(); }

Target:
public TestingHiveOrcAggregatedMemoryContext() { this(newSimpleAggregatedMemoryContext()); }
Source:
public List<Float> apply(Iterable<String> values) throws InvalidAttributeValueException { ImmutableList.Builder<Float> floats = ImmutableList.builder(); for (String value : values) { try { floats.add(Float.valueOf(value)); } catch (NumberFormatException nfe) { throw new InvalidAttributeValueException(value); } } return floats.build(); }

Target:
public List<Float> apply(Iterable<String> values) throws InvalidAttributeValueException { ImmutableList.Builder<Float> floats = ImmutableList.builder(); for (String value : values) { try { floats.add(Float.valueOf(value)); } catch (NumberFormatException e) { throw new InvalidAttributeValueException(value, e); } } return floats.build(); }
Source:
public void recordRolledUpUsage(final SubscriptionUsageRecord record, final CallContext callContext) throws UsageApiException { final InternalCallContext internalCallContext = internalCallContextFactory.createInternalCallContext(record.getSubscriptionId(), ObjectType.SUBSCRIPTION, callContext); final String trackingIds; if (Strings.isNullOrEmpty(record.getTrackingId())) { trackingIds = UUIDs.randomUUID().toString(); } else if (recordsWithTrackingIdExist(record, internalCallContext)) { throw new UsageApiException(ErrorCode.USAGE_RECORD_TRACKING_ID_ALREADY_EXISTS, record.getTrackingId()); } else { trackingIds = record.getTrackingId(); } if (!Strings.isNullOrEmpty(record.getTrackingId()) && recordsWithTrackingIdExist(record, internalCallContext)) { } final List<RolledUpUsageModelDao> usages = new ArrayList<RolledUpUsageModelDao>(); for (final UnitUsageRecord unitUsageRecord : record.getUnitUsageRecord()) { for (final UsageRecord usageRecord : unitUsageRecord.getDailyAmount()) { usages.add(new RolledUpUsageModelDao(record.getSubscriptionId(), unitUsageRecord.getUnitType(), usageRecord.getDate(), usageRecord.getAmount(), trackingIds)); } } rolledUpUsageDao.record(usages, internalCallContext); }

Target:
public void recordRolledUpUsage(final SubscriptionUsageRecord record, final CallContext callContext) throws UsageApiException { final InternalCallContext internalCallContext = internalCallContextFactory.createInternalCallContext(record.getSubscriptionId(), ObjectType.SUBSCRIPTION, callContext); final String trackingIds; if (Strings.isNullOrEmpty(record.getTrackingId())) { trackingIds = UUIDs.randomUUID().toString(); } else if (recordsWithTrackingIdExist(record, internalCallContext)) { throw new UsageApiException(ErrorCode.USAGE_RECORD_TRACKING_ID_ALREADY_EXISTS, record.getTrackingId()); } else { trackingIds = record.getTrackingId(); } final List<RolledUpUsageModelDao> usages = new ArrayList<RolledUpUsageModelDao>(); for (final UnitUsageRecord unitUsageRecord : record.getUnitUsageRecord()) { for (final UsageRecord usageRecord : unitUsageRecord.getDailyAmount()) { usages.add(new RolledUpUsageModelDao(record.getSubscriptionId(), unitUsageRecord.getUnitType(), usageRecord.getDate(), usageRecord.getAmount(), trackingIds)); } } rolledUpUsageDao.record(usages, internalCallContext); }
Source:
public static boolean isVersionMatchStorageType(Version version, boolean isLocalType) { if (isLocalType) { return version.compareTo(new Version(3, 0)) >= 0; } else { return version.compareTo(new Version(3, 0)) >= 0; } }

Target:
public static boolean isVersionMatchStorageType(Version version, boolean isLocalType) { return version.compareTo(new Version(3, 0)) >= 0; }
Source:
public String[] getArray(String key) { int resourceId = context.getResources().getIdentifier(key, "array", context.getPackageName()); return context.getResources().getStringArray(resourceId); }

Target:
public String[] getArray(String key) { int resourceId = context.getResources().getIdentifier(key, "array", context.getPackageName()); if (resourceId == 0) { throw new RuntimeException("Localized array data for '" + key + "' not found"); } return context.getResources().getStringArray(resourceId); }
Source:
public Dialog onCreateDialog(Bundle savedInstanceState) { final Fragment targetFragment = getTargetFragment(); if (targetFragment == null || !(targetFragment instanceof Listener)) { throw new IllegalStateException("Target fragment must implement ReceiptAttachmentDialogFragment.Listener interface"); } AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getContext()); dialogBuilder.setTitle(receipt.getName()) .setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.cancel()); final View dialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_receipt_attachment, null); dialogBuilder.setView(dialogView); final AlertDialog dialog = dialogBuilder.create(); dialogView.findViewById(R.id.attach_photo).setOnClickListener(v -> { ((Listener) targetFragment).setImageUri(receiptAttachmentManager.attachPhoto(getTargetFragment())); dialog.cancel(); }); dialogView.findViewById(R.id.attach_picture).setOnClickListener(v -> { if (!receiptAttachmentManager.attachPicture(getTargetFragment(), false)) { Toast.makeText(getContext(), getString(R.string.error_no_file_intent_dialog_title), Toast.LENGTH_SHORT).show(); } dialog.cancel(); }); dialogView.findViewById(R.id.attach_file).setOnClickListener(v -> { if (!receiptAttachmentManager.attachFile(getTargetFragment(), false)) { Toast.makeText(getContext(), getString(R.string.error_no_file_intent_dialog_title), Toast.LENGTH_SHORT).show(); } dialog.cancel(); }); return dialog; }

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { final Fragment parentFragment = getParentFragment(); if (parentFragment == null || !(parentFragment instanceof Listener)) { throw new IllegalStateException("Parent fragment must implement ReceiptAttachmentDialogFragment.Listener interface"); } AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getContext()); dialogBuilder.setTitle(receipt.getName()) .setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.dismiss()); final View dialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_receipt_attachment, null); dialogBuilder.setView(dialogView); final AlertDialog dialog = dialogBuilder.create(); dialogView.findViewById(R.id.attach_photo).setOnClickListener(v -> { ((Listener) parentFragment).setImageUri(receiptAttachmentManager.attachPhoto(parentFragment)); dialog.dismiss(); }); dialogView.findViewById(R.id.attach_picture).setOnClickListener(v -> { if (!receiptAttachmentManager.attachPicture(parentFragment, false)) { Toast.makeText(getContext(), getString(R.string.error_no_file_intent_dialog_title), Toast.LENGTH_SHORT).show(); } dialog.dismiss(); }); dialogView.findViewById(R.id.attach_file).setOnClickListener(v -> { if (!receiptAttachmentManager.attachFile(parentFragment, false)) { Toast.makeText(getContext(), getString(R.string.error_no_file_intent_dialog_title), Toast.LENGTH_SHORT).show(); } dialog.dismiss(); }); return dialog; }
Source:
public void deleteGroup(final String groupId) { final Group group = groupMap.get(groupId); if (group == null) { LOG.log(Level.WARNING, "There is no such group {0}.", new Object[] {groupId}); return; } group.getApplicationInfo().getQueryRemover().deleteAllQueries(); applicationMap.remove(groupId); groupAllocationTableModifier.addEvent( new WritingEvent(WritingEvent.EventType.GROUP_REMOVE_ALL, null)); }

Target:
public void deleteGroup(final String groupId) { final Group group = groupMap.get(groupId); if (group == null) { LOG.log(Level.WARNING, "There is no such group {0}.", new Object[] {groupId}); return; } final QueryRemover remover = group.getApplicationInfo().getQueryRemover(); for (final Query query : group.getQueries()) { remover.deleteQuery(query.getId()); } applicationMap.remove(groupId); groupAllocationTableModifier.addEvent( new WritingEvent(WritingEvent.EventType.GROUP_REMOVE_ALL, null)); }
Source:
private StringConverter<Double> getLabelConverter() { return new StringConverter<>() { @Override public String toString(Double n) { if (n < 127) { return "None"; } return "Lots"; } @Override public Double fromString(String s) { if (s.equals("None")) { return 0d; } return 127d; } }; }

Target:
private StringConverter<Double> getLabelConverter() { return new StringConverter<>() { @Override public String toString(Double n) { if (n < 127) { return "%game.generate.none"; } return "%game.generate.lots"; } @Override public Double fromString(String s) { throw new UnsupportedOperationException(); } }; }
Source:
Something getSomething() { final long valueAtCreationTime = getValue(); return new Something() { private final long creation = valueAtCreationTime; private final long creation2; @Override public void printCreation() { System.out.println(this.creation); } }; }

Target:
Something getSomething() { final long valueAtCreationTime = getValue(); return new Something() { private final long creation = valueAtCreationTime; private final String creationStr = "" + valueAtCreationTime; private final long creation2; @Override public void printCreation() { System.out.println(this.creation); } }; }
Source:
public void run() { setAutoExpandLevel(DEFAULT_AUTOEXPAND); List<@NonNull TimeGraphEntry> traceEntries = getEntryList(getTrace()); if (traceEntries == null) { return; } TimeGraphControl control = getTimeGraphViewer().getTimeGraphControl(); for (TimeGraphEntry traceEntry : traceEntries) { Iterables.filter(Utils.flatten(traceEntry), AttributeEntry.class) .forEach(attribute -> control.setExpandedState(attribute, false)); } redraw(); }

Target:
public void run() { setAutoExpandLevel(DEFAULT_AUTOEXPAND); List<@NonNull TimeGraphEntry> traceEntries = getEntryList(getTrace()); if (traceEntries == null) { return; } TimeGraphControl control = getTimeGraphViewer().getTimeGraphControl(); for (TimeGraphEntry traceEntry : traceEntries) { for (TimeGraphEntry moduleEntry : traceEntry.getChildren()) { for (TimeGraphEntry stateSystemEntry : moduleEntry.getChildren()) { Utils.flatten(stateSystemEntry).forEach(attribute -> control.setExpandedState(attribute, false)); } } } redraw(); }
Source:
public static void setUpClass() throws Exception { if (!root.exists()) { skip=true; return; } files = new ArrayList<>(); RepositoryFactory.setIgnored(); FileUtilities.getAllFiles(root, files, false); }

Target:
public static void setUpClass() throws Exception { if (!root.exists()) { skip=true; return; } files = new ArrayList<>(); RepositoryFactory.setIgnored(RuntimeEnvironment.getInstance()); FileUtilities.getAllFiles(root, files, false); }
Source:
private void compareCaseDbState(String inputTransactions, String caseDbState) throws Exception { MockDataUtils.parseIntoSandbox(this.getClass().getResourceAsStream(inputTransactions), sandbox, true); EvaluationContext ec = MockDataUtils.buildContextWithInstance(this.sandbox, "casedb", CaseTestUtils.CASE_INSTANCE); Assert.assertTrue(CaseTestUtils.xpathEvalAndCompare(ec, "instance('casedb')/casedb/case[@case_id = 'case_one']/case_name", "case")); byte[] parsedDb = serializeCaseInstanceFromSandbox(sandbox); Document parsed = XmlComparator.getDocumentFromStream(new ByteArrayInputStream(parsedDb)); Document loaded = XmlComparator.getDocumentFromStream(this.getClass().getResourceAsStream(caseDbState)); try { XmlComparator.isDOMEqual(parsed, loaded); } catch(Exception e) { System.out.print(new String(parsedDb)); Assert.assertEquals("CaseDB output did not match expected structure(" + e.getMessage() + ")", new String(dumpStream(caseDbState)), new String(parsedDb)); } }

Target:
private void compareCaseDbState(String inputTransactions, String caseDbState) throws Exception { MockDataUtils.parseIntoSandbox(this.getClass().getResourceAsStream(inputTransactions), sandbox); EvaluationContext ec = MockDataUtils.buildContextWithInstance(this.sandbox, "casedb", CaseTestUtils.CASE_INSTANCE); Assert.assertTrue(CaseTestUtils.xpathEvalAndCompare(ec, "instance('casedb')/casedb/case[@case_id = 'case_one']/case_name", "case")); byte[] parsedDb = serializeCaseInstanceFromSandbox(sandbox); Document parsed = XmlComparator.getDocumentFromStream(new ByteArrayInputStream(parsedDb)); Document loaded = XmlComparator.getDocumentFromStream(this.getClass().getResourceAsStream(caseDbState)); try { XmlComparator.isDOMEqual(parsed, loaded); } catch(Exception e) { System.out.print(new String(parsedDb)); Assert.assertEquals("CaseDB output did not match expected structure(" + e.getMessage() + ")", new String(dumpStream(caseDbState)), new String(parsedDb)); } }
Source:
public static boolean isRecoverableException(final Throwable t) { if(t instanceof IOException) { return true; } return false; }

Target:
public static boolean isRecoverableException(final Throwable t) { return t instanceof IOException; }
Source:
protected HierarchicalConfiguration getConfiguration(Function<String, InputStream> configGetter) { logger.debug("Reading blob store configuration"); try (InputStream is = configGetter.apply(configurationPath)) { if (is != null) { return configurationReader.readXmlConfiguration(is, "utf-8"); } } catch (Exception e) { logger.error("Error reading blob store configuration", e); } return null; }

Target:
protected HierarchicalConfiguration getConfiguration(Function<String, InputStream> configGetter) throws IOException, ConfigurationException { logger.debug("Reading blob store configuration"); try (InputStream is = configGetter.apply(configurationPath)) { if (is != null) { return configurationReader.readXmlConfiguration(is, "utf-8"); } } catch (IOException | ConfigurationException e) { logger.error("Error reading blob store configuration", e); throw e; } return null; }
Source:
public String nullableAnnotation() { for (String annotationString : annotations) { if (annotationString.equals("@Nullable") || annotationString.endsWith(".Nullable")) { return annotationString; } } return ""; }

Target:
public String nullableAnnotation() { for (String annotationString : annotations) { if (annotationString.equals("@Nullable") || annotationString.endsWith(".Nullable")) { return annotationString; } } return null; }
Source:
public static String expandBrackets(String pattern, Character keywordDelimiter, BibEntry entry, BibDatabase database) { Objects.requireNonNull(pattern); Objects.requireNonNull(entry); StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(pattern, "\\[]\"", true); while (st.hasMoreTokens()) { String token = st.nextToken(); if ("\"".equals(token)) { sb.append(token); while (st.hasMoreTokens()) { token = st.nextToken(); sb.append(token); if ("\"".equals(token)) { break; } } } else { if ("\\".equals(token)) { if (st.hasMoreTokens()) { sb.append(st.nextToken()); } } else { if ("[".equals(token)) { token = st.nextToken(); Boolean foundClosingBracket = false; while (st.hasMoreTokens()) { String subtoken = st.nextToken(); if ("\"".equals(subtoken)) { token = token + subtoken; while (st.hasMoreTokens()) { subtoken = st.nextToken(); token = token + subtoken; if ("\"".equals(subtoken)) { break; } } } else { if ("]".equals(subtoken)) { foundClosingBracket = true; break; } else { token = token + subtoken; } } } if (!foundClosingBracket) { LOGGER.warn("Missing closing bracket ']' in '" + pattern + "'"); } List<String> fieldParts = parseFieldMarker(token); if (fieldParts.size() <= 1) { sb.append(getFieldValue(entry, token, keywordDelimiter, database)); } else { String fieldValue = getFieldValue(entry, fieldParts.get(0), keywordDelimiter, database); sb.append(applyModifiers(fieldValue, fieldParts, 1)); } } else { sb.append(token); } } } } return sb.toString(); }

Target:
public static String expandBrackets(String pattern, Character keywordDelimiter, BibEntry entry, BibDatabase database) { Objects.requireNonNull(pattern); Objects.requireNonNull(entry); StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(pattern, "\\[]\"", true); while (st.hasMoreTokens()) { String token = st.nextToken(); if ("\"".equals(token)) { sb.append(token); while (st.hasMoreTokens()) { token = st.nextToken(); sb.append(token); if ("\"".equals(token)) { break; } } } else { if ("\\".equals(token)) { if (st.hasMoreTokens()) { sb.append(st.nextToken()); } } else { if ("[".equals(token)) { Boolean foundClosingBracket = false; token = st.nextToken(); if ("]".equals(token)) { LOGGER.warn("Found empty brackets \"[]\" in '" + pattern + "'"); foundClosingBracket = true; } while (st.hasMoreTokens() && !foundClosingBracket) { String subtoken = st.nextToken(); if ("\"".equals(subtoken)) { token = token + subtoken; while (st.hasMoreTokens()) { subtoken = st.nextToken(); token = token + subtoken; if ("\"".equals(subtoken)) { break; } } } else { if ("]".equals(subtoken)) { foundClosingBracket = true; break; } else { token = token + subtoken; } } } if (!foundClosingBracket) { LOGGER.warn("Missing closing bracket ']' in '" + pattern + "'"); } List<String> fieldParts = parseFieldMarker(token); if (fieldParts.size() <= 1) { sb.append(getFieldValue(entry, token, keywordDelimiter, database)); } else { String fieldValue = getFieldValue(entry, fieldParts.get(0), keywordDelimiter, database); sb.append(applyModifiers(fieldValue, fieldParts, 1)); } } else { sb.append(token); } } } } return sb.toString(); }
Source:
public void close() { try { httpClient.close(); if (httpPoolingClient != null) httpPoolingClient.close(); } catch (IOException e) { } }

Target:
public void close() { try { httpClient.close(); } catch (IOException e) { LOG.debug(e); } if (httpPoolingClient != null) { try { httpPoolingClient.close(); } catch (IOException e) { LOG.debug(e); } } }
Source:
public AbstractExpression processTVE(TupleValueExpression expr, String columnName) { if (m_origSubqueryScan != null) { expr.setTableName(getTableName()); Integer columnIndex = m_origSubqueryScan.getColumnIndex(columnName, expr.getDifferentiator()); assert(columnIndex != null); SchemaColumn origColumnSchema = m_origSubqueryScan.getSchemaColumn(columnIndex); assert(origColumnSchema != null); AbstractExpression colExpr = (AbstractExpression) origColumnSchema.getExpression(); List<TupleValueExpression> tves = ExpressionUtil.getTupleValueExpressions(colExpr); for (TupleValueExpression tve : tves) { tve.setTableAlias(expr.getTableAlias()); tve.setColumnAlias(expr.getColumnAlias()); tve.resolveForTable(m_table); } return colExpr; } expr.resolveForTable(m_table); return expr; }

Target:
public AbstractExpression processTVE(TupleValueExpression expr, String columnName) { if (m_origSubqueryScan != null) { expr.setTableName(getTableName()); Integer columnIndex = m_origSubqueryScan.getColumnIndex(columnName, expr.getDifferentiator()); assert(columnIndex != null); SchemaColumn origColumnSchema = m_origSubqueryScan.getSchemaColumn(columnIndex); assert(origColumnSchema != null); AbstractExpression colExpr = origColumnSchema.getExpression(); List<TupleValueExpression> tves = ExpressionUtil.getTupleValueExpressions(colExpr); for (TupleValueExpression tve : tves) { tve.setTableAlias(expr.getTableAlias()); tve.setColumnAlias(expr.getColumnAlias()); tve.resolveForTable(m_table); } return colExpr; } expr.resolveForTable(m_table); return expr; }
Source:
public CompletableFuture<Void> deleteColumnFamily(TableName tableName, byte[] columnName) { return CompletableFuture.supplyAsync(() -> { Modification.Builder modification = Modification.newBuilder().setId(Bytes.toString(columnName)) .setDrop(true); ModifyColumnFamiliesRequest.Builder modifyColumnBuilder = ModifyColumnFamiliesRequest .newBuilder().addModifications(modification).setName(toBigtableName(tableName)); return modifyColumnBuilder; }).thenCompose( d -> FutureUtils.toCompletableFuture( bigtableTableAdminClient.modifyColumnFamilyAsync(d.build())) .thenApply(r -> null)); }

Target:
public CompletableFuture<Void> deleteColumnFamily(TableName tableName, byte[] columnName) { Modification.Builder modification = Modification.newBuilder().setId(Bytes.toString(columnName)) .setDrop(true); ModifyColumnFamiliesRequest request = ModifyColumnFamiliesRequest .newBuilder().addModifications(modification).setName(toBigtableName(tableName)).build(); return FutureUtils.toCompletableFuture( bigtableTableAdminClient. modifyColumnFamilyAsync(request)). thenApply(response -> null); }
Source:
private void onUpgrade(SQLiteConnection db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + MARKERS_TABLE_NAME); db.execSQL("DROP TABLE IF EXISTS " + GROUPS_TABLE_NAME); onCreate(db); }

Target:
private void onUpgrade(SQLiteConnection db, int oldVersion, int newVersion) { }
Source:
public static void analyzeFiles(Set<String> filenames) throws ArgumentParserException, IOException { long numErrors = 0; MaxLengths maxLengths = argumentParser.parseMaxLengths(); Severity maxSeverity = argumentParser.getMaxSeverity(); ColorSettings colorSettings = new ColorSettings(argumentParser.shouldColorOutput(), argumentParser.shouldInvertColorOutput()); Set<Rules> enabledRules = argumentParser.getEnabledRules(); for (String filename : filenames) { File inputFile = new File(filename); CommonTokenStream tokenStream; SwiftParser.TopLevelContext tree; try { tokenStream = getTokenStream(inputFile); tree = getParseTree(tokenStream); } catch (ErrorListener.ParseException e) { Printer printer = new Printer(inputFile, maxSeverity, colorSettings); printer.printParseErrorMessage(); continue; } try (Printer printer = new Printer(inputFile, maxSeverity, colorSettings)) { List<SwiftBaseListener> listeners = createListeners(enabledRules, printer, tokenStream); listeners.add(new MaxLengthListener(printer, maxLengths)); listeners.add(new MainListener(printer, maxLengths, tokenStream)); ParseTreeWalker walker = new ParseTreeWalker(); for (SwiftBaseListener listener : listeners) { walker.walk(listener, tree); } try (FileListener fileListener = new FileListener(printer, inputFile, maxLengths)) { fileListener.verify(); } CommentAnalyzer commentAnalyzer = new CommentAnalyzer(tokenStream, printer); commentAnalyzer.analyze(); numErrors += printer.getNumErrorMessages(); } } if (numErrors >= 1L) { System.exit(EXIT_FAILURE); } }

Target:
public static void analyzeFiles(Set<String> filenames) throws ArgumentParserException, IOException { long numErrors = 0; MaxLengths maxLengths = argumentParser.parseMaxLengths(); Severity maxSeverity = argumentParser.getMaxSeverity(); ColorSettings colorSettings = new ColorSettings(argumentParser.shouldColorOutput(), argumentParser.shouldInvertColorOutput()); Set<Rules> enabledRules = argumentParser.getEnabledRules(); for (String filename : filenames) { File inputFile = new File(filename); CommonTokenStream tokenStream; SwiftParser.TopLevelContext tree; try { tokenStream = getTokenStream(inputFile); tree = getParseTree(tokenStream); } catch (ErrorListener.ParseException e) { Printer printer = new Printer(inputFile, maxSeverity, colorSettings); printer.printParseErrorMessage(); continue; } try (Printer printer = new Printer(inputFile, maxSeverity, colorSettings)) { List<SwiftBaseListener> listeners = createListeners(enabledRules, printer); listeners.add(new MaxLengthListener(printer, maxLengths)); listeners.add(new MainListener(printer, maxLengths, tokenStream)); ParseTreeWalker walker = new ParseTreeWalker(); for (SwiftBaseListener listener : listeners) { walker.walk(listener, tree); } try (FileListener fileListener = new FileListener(printer, inputFile, maxLengths)) { fileListener.verify(); } CommentAnalyzer commentAnalyzer = new CommentAnalyzer(tokenStream, printer); commentAnalyzer.analyze(); numErrors += printer.getNumErrorMessages(); } } if (numErrors >= 1L) { System.exit(ExitCode.FAILURE); } }