auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void addClassStaticMembersVariants(Set<HaxeComponentName> suggestedVariants, @Nullable HaxeClass haxeClass, boolean filterByAccess) { if (haxeClass == null) { return; } boolean extern = haxeClass.isExtern(); boolean isEnum = haxeClass instanceof HaxeEnumDeclaration; boolean isAbstractEnum = HaxeAbstractEnumUtil.isAbstractEnum(haxeClass); for (HaxeNamedComponent namedComponent : HaxeResolveUtil.findNamedSubComponents(haxeClass)) { final boolean needFilter = filterByAccess && !namedComponent.isPublic(); final HaxeComponentName componentName = namedComponent.getComponentName(); if(componentName != null) { if(isAbstractEnum && HaxeAbstractEnumUtil.isAbstractEnumField(namedComponent)) { suggestedVariants.add(componentName); } else if ((extern || !needFilter) && (namedComponent.isStatic() || isEnum)) { suggestedVariants.add(componentName); } } } }

Target:
private static void addClassStaticMembersVariants(Set<HaxeComponentName> suggestedVariants, @Nullable HaxeClass haxeClass, boolean filterByAccess) { if (haxeClass == null) { return; } boolean extern = haxeClass.isExtern(); boolean isEnum = haxeClass instanceof HaxeEnumDeclaration; boolean isAbstractEnum = HaxeAbstractEnumUtil.isAbstractEnum(haxeClass); for (HaxeNamedComponent namedComponent : HaxeResolveUtil.findNamedSubComponents(haxeClass)) { final boolean needFilter = filterByAccess && !namedComponent.isPublic(); final HaxeComponentName componentName = namedComponent.getComponentName(); if(componentName != null) { if(isAbstractEnum && HaxeAbstractEnumUtil.couldBeAbstractEnumField(namedComponent)) { suggestedVariants.add(componentName); } else if ((extern || !needFilter) && (namedComponent.isStatic() || isEnum)) { suggestedVariants.add(componentName); } } } }
Source:
public ActionResult execute() { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); StudentProfileAttributes studentProfile = null; if (studentEmail == null || courseId == null) { if (!userInfo.isStudent) { return new JsonResult(STUDENT_NOT_FOUND, HttpStatus.SC_NOT_FOUND); } studentProfile = logic.getStudentProfile(userInfo.id); } else { StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { return new JsonResult(STUDENT_NOT_FOUND, HttpStatus.SC_NOT_FOUND); } studentProfile = logic.getStudentProfile(student.googleId); } if (studentProfile == null || studentProfile.pictureKey.equals("")) { return new JsonResult(PROFILE_PIC_NOT_FOUND, HttpStatus.SC_NOT_FOUND); } return new ImageResult(studentProfile.pictureKey); }

Target:
public ActionResult execute() { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); StudentProfileAttributes studentProfile = null; if (studentEmail == null || courseId == null) { studentProfile = logic.getStudentProfile(userInfo.id); } else { StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (!StringHelper.isEmpty(student.googleId)) { studentProfile = logic.getStudentProfile(student.googleId); } } if (studentProfile == null || studentProfile.pictureKey.equals("")) { return new JsonResult(PROFILE_PIC_NOT_FOUND, HttpStatus.SC_NOT_FOUND); } return new ImageResult(studentProfile.pictureKey); }
Source:
private String buildChargeResponse(CreateChargeResponseFromConnector responseFromConnector) { PaymentSingleResultBuilder resultBuilder = aSuccessfulSinglePayment() .withChargeId(responseFromConnector.chargeId) .withAmount(responseFromConnector.amount) .withMatchingReference(responseFromConnector.reference) .withEmail(responseFromConnector.email) .withDescription(responseFromConnector.description) .withState(responseFromConnector.state) .withReturnUrl(responseFromConnector.returnUrl) .withCreatedDate(responseFromConnector.createdDate) .withLanguage(responseFromConnector.language) .withPaymentProvider(responseFromConnector.paymentProvider) .withDelayedCapture(responseFromConnector.delayedCapture) .withLinks(responseFromConnector.links) .withSettlementSummary(responseFromConnector.settlementSummary) .withCardDetails(responseFromConnector.cardDetails); if (responseFromConnector.refundSummary != null) resultBuilder.withRefundSummary(responseFromConnector.refundSummary); if (responseFromConnector.gatewayTransactionId != null) resultBuilder.withGatewayTransactionId(responseFromConnector.gatewayTransactionId); if (responseFromConnector.corporateCardSurcharge != null) resultBuilder.withCorporateCardSurcharge(responseFromConnector.corporateCardSurcharge); if (responseFromConnector.totalAmount != null) resultBuilder.withTotalAmount(responseFromConnector.totalAmount); responseFromConnector.metadata.ifPresent(m -> resultBuilder.withMetadata(m)); return resultBuilder.build(); }

Target:
private String buildChargeResponse(CreateChargeResponseFromConnector responseFromConnector) { PaymentSingleResultBuilder resultBuilder = aSuccessfulSinglePayment() .withChargeId(responseFromConnector.chargeId) .withAmount(responseFromConnector.amount) .withMatchingReference(responseFromConnector.reference) .withEmail(responseFromConnector.email) .withDescription(responseFromConnector.description) .withState(responseFromConnector.state) .withReturnUrl(responseFromConnector.returnUrl) .withCreatedDate(responseFromConnector.createdDate) .withLanguage(responseFromConnector.language) .withPaymentProvider(responseFromConnector.paymentProvider) .withDelayedCapture(responseFromConnector.delayedCapture) .withLinks(responseFromConnector.links) .withSettlementSummary(responseFromConnector.settlementSummary) .withCardDetails(responseFromConnector.cardDetails); if (responseFromConnector.refundSummary != null) { resultBuilder.withRefundSummary(responseFromConnector.refundSummary); } if (responseFromConnector.gatewayTransactionId != null) { resultBuilder.withGatewayTransactionId(responseFromConnector.gatewayTransactionId); } if (responseFromConnector.corporateCardSurcharge != null) { resultBuilder.withCorporateCardSurcharge(responseFromConnector.corporateCardSurcharge); } if (responseFromConnector.totalAmount != null) { resultBuilder.withTotalAmount(responseFromConnector.totalAmount); } responseFromConnector.metadata.ifPresent(m -> resultBuilder.withMetadata(m)); return resultBuilder.build(); }
Source:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (getArguments() != null && binding != null) { @ScreenDef String screenName = getArguments().getString(Router.EXTRA_SCREEN_NAME); if (screenName != null) { final List<FragmentItemModel> fragmentItems = getFragmentItems(); for (int i = 0; i < fragmentItems.size(); i++) { final FragmentItemModel item = fragmentItems.get(i); if (screenName.equals(Screen.COURSE_VIDEOS) && item.getIcon() == FontAwesomeIcons.fa_film) { binding.viewPager.setCurrentItem(i); break; } } getArguments().putString(Router.EXTRA_SCREEN_NAME, null); } } }

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (getArguments() != null && binding != null) { @ScreenDef final String screenName = getArguments().getString(Router.EXTRA_SCREEN_NAME); if (screenName != null) { final List<FragmentItemModel> fragmentItems = getFragmentItems(); for (int i = 0; i < fragmentItems.size(); i++) { final FragmentItemModel item = fragmentItems.get(i); if (screenName.equals(Screen.COURSE_VIDEOS) && item.getIcon() == FontAwesomeIcons.fa_film) { binding.viewPager.setCurrentItem(i); break; } } getArguments().putString(Router.EXTRA_SCREEN_NAME, null); } } }
Source:
public void startSinglePlayer() { log.log(LogLevel.INFO, "Player Pressed the SingPlayer Button"); Preloader.switchTo("singlePlayer", 400); }

Target:
public void startSinglePlayer() { log.log(LogLevel.INFO, "Player Pressed the SinglePlayer Button."); Preloader.switchTo("singlePlayer", 400); }
Source:
public RuleTester() { session = testSessionBuilder().setCatalog(CATALOG_ID).setSchema("tiny").setSystemProperty("task_concurrency", "1") .build(); queryRunner = new LocalQueryRunner(session); queryRunner.createCatalog(session.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.<String, String>of()); this.metadata = queryRunner.getMetadata(); this.costCalculator = queryRunner.getCostCalculator(); this.transactionManager = queryRunner.getTransactionManager(); this.accessControl = queryRunner.getAccessControl(); }

Target:
public RuleTester() { session = testSessionBuilder() .setCatalog(CATALOG_ID) .setSchema("tiny") .setSystemProperty("task_concurrency", "1") .build(); queryRunner = new LocalQueryRunner(session); queryRunner.createCatalog(session.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of()); this.metadata = queryRunner.getMetadata(); this.costCalculator = queryRunner.getCostCalculator(); this.transactionManager = queryRunner.getTransactionManager(); this.accessControl = queryRunner.getAccessControl(); }
Source:
public void optionalCommentOnLanguage(IRCBotUser user, OsuApiUser apiUser) { user.message("ikhebepicmuis-jan learned me to talk Farsi!"); }

Target:
public void optionalCommentOnLanguage(IRCBotUser user, OsuApiUser apiUser) { user.message("ikhebepicmuis Farsi-harfzadano yaadamdaad!"); }
Source:
FieldCapabilitiesIndexRequest(StreamInput in) throws IOException { super(in); if (in.readBoolean()) { shardId = new ShardId(in); } index = in.readOptionalString(); fields = in.readStringArray(); originalIndices = OriginalIndices.readOriginalIndices(in); indexFilter = in.getVersion().onOrAfter(Version.V_8_0_0) ? in.readOptionalNamedWriteable(QueryBuilder.class) : null; nowInMillis = in.getVersion().onOrAfter(Version.V_8_0_0) ? in.readLong() : 0L; }

Target:
FieldCapabilitiesIndexRequest(StreamInput in) throws IOException { super(in); shardId = in.readOptionalWriteable(ShardId::new); index = in.readOptionalString(); fields = in.readStringArray(); originalIndices = OriginalIndices.readOriginalIndices(in); indexFilter = in.getVersion().onOrAfter(Version.V_8_0_0) ? in.readOptionalNamedWriteable(QueryBuilder.class) : null; nowInMillis = in.getVersion().onOrAfter(Version.V_8_0_0) ? in.readLong() : 0L; }
Source:
public void serverSend(final Receiver receiver, final Delivery delivery, String address, int messageFormat, ByteBuf messageEncoded) throws Exception { EncodedMessage encodedMessage = new EncodedMessage(messageFormat, messageEncoded.array(), messageEncoded.arrayOffset(), messageEncoded.writerIndex()); ServerMessage message = manager.getConverter().inbound(encodedMessage); if (address != null) { message.setAddress(new SimpleString(address)); } recoverContext(); PagingStore store = manager.getServer().getPagingManager().getPageStore(message.getAddress()); if (store.isRejectingMessages()) { if (delivery.remotelySettled()) { if (serverSession.getCurrentTransaction() != null) { rollbackCurrentTX(false); AMQPSessionContext context = ((AMQPSessionContext) delivery.getLink().getSession().getContext()); ProtonTransactionHandler handler = (ProtonTransactionHandler) context.getCoordinatorLink().getContext(); handler.close(false); } } else { rejectMessage(delivery, message.getAddress()); } } else { serverSend(message, delivery, receiver); } }

Target:
public void serverSend(final Receiver receiver, final Delivery delivery, String address, int messageFormat, ByteBuf messageEncoded) throws Exception { EncodedMessage encodedMessage = new EncodedMessage(messageFormat, messageEncoded.array(), messageEncoded.arrayOffset(), messageEncoded.writerIndex()); ServerMessage message = manager.getConverter().inbound(encodedMessage); if (address != null) { message.setAddress(new SimpleString(address)); } recoverContext(); PagingStore store = manager.getServer().getPagingManager().getPageStore(message.getAddress()); if (store.isRejectingMessages()) { if (delivery.remotelySettled()) { if (serverSession.getCurrentTransaction() != null) { String amqpAddress = delivery.getLink().getTarget().getAddress(); ActiveMQException e = new ActiveMQAMQPResourceLimitExceededException("Address is full: " + amqpAddress); serverSession.getCurrentTransaction().markAsRollbackOnly(e); } } else { rejectMessage(delivery); } } else { serverSend(message, delivery, receiver); } }
Source:
@Override public Set<String> variables() { return new HashSet<String>(Arrays.asList(keyFileVariable, usernameVariable, passphraseVariable)); }

Target:
@Override public Set<String> variables() { Set<String> set = new HashSet<>(); set.add(keyFileVariable); if (usernameVariable != null) { set.add(usernameVariable); } if (passphraseVariable != null) { set.add(passphraseVariable); } return ImmutableSet.copyOf(set); }
Source:
findProblematicTimeSeriesElement(String msg, List<TimeSeries> nextN) { String regex = "timeSeries\\[(\\d+?)\\]\\.metric\\.labels\\[(\\d+?)\\]"; Matcher matcher = Pattern.compile(regex).matcher(msg); if (matcher.find()) { int tsIndex = Integer.parseInt(matcher.group(1)) - 1; TimeSeries ts = nextN.get(tsIndex); return ts; } return null; }

Target:
findProblematicTimeSeriesElement(String msg, List<TimeSeries> nextN) { String regex = "timeSeries\\[(\\d+?)\\]\\.metric\\.labels\\[(\\d+?)\\]"; Matcher matcher = Pattern.compile(regex).matcher(msg); if (matcher.find()) { int tsIndex = Integer.parseInt(matcher.group(1)); return nextN.get(tsIndex); } return null; }
Source:
public void downloadRemoteIndex(String storageId, String repositoryId) throws ArtifactTransportException { Storage storage = getConfiguration().getStorage(storageId); Repository repository = storage.getRepository(repositoryId); String repositoryBasedir = repository.getBasedir(); File remoteIndexDirectory = new File(repositoryBasedir, ".index/remote"); RepositoryIndexer indexer = repositoryIndexManager.getRepositoryIndex(storageId + ":" + repositoryId); IndexDownloadRequest request = new IndexDownloadRequest(); request.setIndexingContextId(storageId + ":" + repositoryId); request.setRepositoryId(repositoryId); request.setRemoteRepositoryURL(repository.getRemoteRepository().getUrl()); request.setIndexLocalCacheDir(repositoryBasedir); request.setIndexDir(remoteIndexDirectory.toString()); request.setIndexer(indexer.getIndexer()); try { downloader.download(request); } catch (IOException | ComponentLookupException e) { throw new ArtifactTransportException("Failed to retrieve remote index for " + storageId + ":" + repositoryId + "!"); } }

Target:
public void downloadRemoteIndex(String storageId, String repositoryId) throws ArtifactTransportException, RepositoryInitializationException { Storage storage = getConfiguration().getStorage(storageId); Repository repository = storage.getRepository(repositoryId); File repositoryBasedir = new File(repository.getBasedir()); File remoteIndexDirectory = new File(repositoryBasedir, ".index/remote"); if (!remoteIndexDirectory.exists()) { remoteIndexDirectory.mkdirs(); } RepositoryIndexer repositoryIndexer = createRepositoryIndexer(storageId, repositoryId, IndexTypeEnum.REMOTE.getType(), repositoryBasedir); IndexDownloadRequest request = new IndexDownloadRequest(); request.setIndexingContextId(storageId + ":" + repositoryId + ":remote"); request.setStorageId(storageId); request.setRepositoryId(repositoryId); request.setRemoteRepositoryURL(repository.getRemoteRepository().getUrl()); request.setIndexLocalCacheDir(repositoryBasedir); request.setIndexDir(remoteIndexDirectory.toString()); request.setIndexer(repositoryIndexer.getIndexer()); try { downloader.download(request); } catch (IOException | ComponentLookupException e) { throw new ArtifactTransportException("Failed to retrieve remote index for " + storageId + ":" + repositoryId + "!"); } }
Source:
public void tearDown() throws Exception { server.stop(); Files.walk(server.getFtpRoot()) .sorted(Comparator.reverseOrder()) .map(java.nio.file.Path::toFile) .forEach(File::delete); }

Target:
public void tearDown() throws Exception { if (server != null) { server.stop(); Files.walk(server.getFtpRoot()) .sorted(Comparator.reverseOrder()) .map(java.nio.file.Path::toFile) .forEach(File::delete); } }
Source:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } if (tree.is(Tree.Kind.METHOD_INVOCATION)) { MethodInvocationTree mit = (MethodInvocationTree) tree; if (mit.arguments().size() >= 2 && ASSERT_THROWS_MATCHER.matches(mit)) { Optional<IdentifierTree> expectedException = getExpectedException(mit.arguments().get(0)); ExpressionTree executable = mit.arguments().get(1); if (expectedException.isPresent() && executable.is(Tree.Kind.LAMBDA_EXPRESSION)) { IdentifierTree expectedIdentifier = expectedException.get(); reportMultipleCallThrowingExceptionInTree(expectedIdentifier.symbolType(), ((LambdaExpressionTree) executable).body(), expectedIdentifier); } } } else { TryStatementTree tryStatementTree = (TryStatementTree) tree; if (isTryCatchIdiom(tryStatementTree)) { tryStatementTree.catches().forEach(c -> reportMultipleCallThrowingExceptionInTree(c.parameter().type().symbolType(), tryStatementTree.block(), c.parameter().type()) ); } } }

Target:
public void visitNode(Tree tree) { if (tree.is(Tree.Kind.METHOD_INVOCATION)) { MethodInvocationTree mit = (MethodInvocationTree) tree; Arguments arguments = mit.arguments(); IdentifierTree identifierTree = ExpressionUtils.methodName(mit); if (JUNIT4_ASSERT_THROWS_WITH_MESSAGE.matches(mit)) { processAssertThrowsArguments(identifierTree, arguments.get(1), arguments.get(2)); } else if (arguments.size() >= 2 && ALL_ASSERT_THROWS_MATCHER.matches(mit)) { processAssertThrowsArguments(identifierTree, arguments.get(0), arguments.get(1)); } } else { TryStatementTree tryStatementTree = (TryStatementTree) tree; if (isTryCatchFail(tryStatementTree)) { List<Type> expectedTypes = tryStatementTree.catches().stream().map(c -> c.parameter().type().symbolType()).collect(Collectors.toList()); reportMultipleCallThrowingExceptionInTree(expectedTypes, tryStatementTree.block(), tryStatementTree.tryKeyword(), "body of this try/catch"); } } }
Source:
public Protos.FrameworkID getFwId() { return fwId; }

Target:
public synchronized Protos.FrameworkID getFwId() { return fwId; }
Source:
private boolean testServerSideInclude(String parameter, String value, Pattern testEvidence) { if (isStop()) { return true; } HttpMessage message = getNewMsg(); try { setParameter(message, parameter, value); sendAndReceive(message); StringBuilder evidence = new StringBuilder(); if (matchBodyPattern(message, testEvidence, evidence)) { bingo(Alert.RISK_HIGH, Alert.CONFIDENCE_MEDIUM, null, parameter, value, value, evidence.toString(), message); return true; } } catch (IOException e) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("IO exception while sending a message [URI=" + getBaseMsg().getRequestHeader().getURI() + ", parameter=" + parameter + ", value=" + value + "]:", e); } } return false; }

Target:
private boolean testServerSideInclude(String parameter, String value, Pattern testEvidence) { if (isStop()) { return true; } HttpMessage message = getNewMsg(); try { setParameter(message, parameter, value); sendAndReceive(message); StringBuilder evidence = new StringBuilder(); if (matchBodyPattern(message, testEvidence, evidence)) { bingo(Alert.RISK_HIGH, Alert.CONFIDENCE_MEDIUM, null, parameter, value, null, evidence.toString(), message); return true; } } catch (IOException e) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("IO exception while sending a message [URI=" + getBaseMsg().getRequestHeader().getURI() + ", parameter=" + parameter + ", value=" + value + "]:", e); } } return false; }
Source:
protected BaseDisk generateNewEntity() { BaseDisk d = new BaseDisk(); d.setId(Guid.newGuid()); d.setWipeAfterDelete(true); d.setPropagateErrors(PropagateErrors.Off); d.setDiskAlias("DiskName"); d.setSgio(ScsiGenericIO.FILTERED); d.setDiskDescription(""); return d; }

Target:
protected BaseDisk generateNewEntity() { BaseDisk d = new BaseDisk(); d.setId(Guid.newGuid()); d.setWipeAfterDelete(true); d.setPropagateErrors(PropagateErrors.Off); d.setDiskAlias("DiskName"); d.setSgio(ScsiGenericIO.FILTERED); return d; }
Source:
protected Instant[] bisectAndCoerce(String value) throws InvalidAttributeValueException { if (value.length() % 2 != 1) { throw new InvalidAttributeValueException(value); } int mid = (value.length()-1)/2; String from = value.substring(0, mid); String to = value.substring(mid+1); try { return new Instant[] { coercerFunction.apply(from), coercerFunction.apply(to) }; } catch (DateTimeParseException e) { throw new InvalidAttributeValueException(value); } }

Target:
protected Instant[] bisectAndCoerce(String value) throws InvalidAttributeValueException { if (value.length() != 41 && value.charAt(20) == RANGE_SEPARATOR_CHAR) { throw new InvalidAttributeValueException(value); } String from = value.substring(0, 20); String to = value.substring(21); try { return new Instant[] { coercerFunction.apply(from), coercerFunction.apply(to) }; } catch (DateTimeParseException e) { throw new InvalidAttributeValueException(value); } }
Source:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; Symbol.MethodSymbol overriddenSymbol = methodTree.symbol().overriddenSymbol(); if (overriddenSymbol == null || overriddenSymbol.isUnknown()) { return; } MethodTree overridenMethodTree = overriddenSymbol.declaration(); if (null != overridenMethodTree && isSynchronized(overridenMethodTree) && !isSynchronized(methodTree)) { reportIssue(methodTree.simpleName(), "Make this method \"synchronized\" to match the parent class implementation."); } }

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; Symbol.MethodSymbol methodSymbol = methodTree.symbol(); Symbol.MethodSymbol overriddenSymbol = methodSymbol.overriddenSymbol(); if (overriddenSymbol == null || overriddenSymbol.isUnknown()) { return; } if (isSynchronized(overriddenSymbol) && !isSynchronized(methodSymbol)) { List<JavaFileScannerContext.Location> secondaries = Collections.emptyList(); MethodTree overridenMethodTree = overriddenSymbol.declaration(); if (overridenMethodTree != null) { secondaries = Collections.singletonList(new JavaFileScannerContext.Location("", overridenMethodTree.simpleName())); } reportIssue(methodTree.simpleName(), MESSAGE, secondaries, null); } }
Source:
public boolean equals(final Object o) { assert o != null; if (o == this) { return true; } if (!(o instanceof Variable)) { return false; } Variable var = (Variable) o; if (var.source == source) { assert name.equals(var.name) : "Defined in the same place, but names not equal?"; return true; } if (var.name == "self" && name == "self") { return true; } assert source == null || !source.equals(var.source) : "Why are there multiple objects for this source section? might need to fix comparison above"; return false; }

Target:
public boolean equals(final Object o) { assert o != null; if (o == this) { return true; } if (!(o instanceof Variable)) { return false; } Variable var = (Variable) o; if (var.source == source) { assert name.equals(var.name) : "Defined in the same place, but names not equal?"; return true; } assert source == null || !source.equals(var.source) : "Why are there multiple objects for this source section? might need to fix comparison above"; return false; }
Source:
static Properties getRouterProperties(String routerDatacenter) { Properties properties = new Properties(); properties.setProperty("router.hostname", "localhost"); properties.setProperty("router.datacenter.name", routerDatacenter); properties.setProperty("router.connection.checkout.timeout.ms", "5000"); properties.setProperty("router.request.timeout.ms", "20000"); properties.setProperty("router.max.put.chunk.size.bytes", Integer.toString(CHUNK_SIZE)); properties.setProperty("router.put.success.target", "1"); properties.setProperty("coordinator.hostname", "localhost"); properties.setProperty("coordinator.datacenter.name", routerDatacenter); return properties; }

Target:
static Properties getRouterProperties(String routerDatacenter) { Properties properties = new Properties(); properties.setProperty("router.hostname", "localhost"); properties.setProperty("router.datacenter.name", routerDatacenter); properties.setProperty("router.connection.checkout.timeout.ms", "5000"); properties.setProperty("router.request.timeout.ms", "10000"); properties.setProperty("router.max.put.chunk.size.bytes", Integer.toString(CHUNK_SIZE)); properties.setProperty("router.put.success.target", "1"); properties.setProperty("coordinator.hostname", "localhost"); properties.setProperty("coordinator.datacenter.name", routerDatacenter); return properties; }
Source:
public void aliasGeneratorFindsByAlias() { ResultDescription desc = new ResultDescription() { @Override public ResultDescription appendText(String format, Object... args) { return null; } @Override public ResultDescription startStage(String stageName) { return null; } @Override public ResultDescription finishStage() { return null; } }; ScoredCandidates scoredCandidates = aliasGenerator.generate(aliasIdentified2, desc); for (Object scoredCandidate : scoredCandidates.candidates().keySet()) { Object content = scoredCandidates.candidates().get(scoredCandidate); if (content instanceof Content) { assertEquals(content, aliasIdentified1); } else { fail(); } } }

Target:
public void aliasGeneratorFindsByAlias() { ScoredCandidates scoredCandidates = aliasGenerator.generate(aliasIdentified2, desc); for (Object scoredCandidate : scoredCandidates.candidates().keySet()) { Object content = scoredCandidates.candidates().get(scoredCandidate); assertTrue(content instanceof Content); assertEquals(content, aliasIdentified1); } }
Source:
public KieServerImpl(KieServerStateRepository stateRepository) { this.repository = stateRepository; String modeParam = System.getProperty(KieServerConstants.KIE_SERVER_MODE, KieServerMode.DEVELOPMENT.toString()); try { mode = KieServerMode.valueOf(modeParam.toUpperCase()); logger.info("Starting server in '" + mode.name() + "' mode."); } catch (Exception ex) { mode = KieServerMode.DEVELOPMENT; logger.warn("Unable to parse value of " + KieServerConstants.KIE_SERVER_MODE + " = " + modeParam + "; supported values are 'REGULAR' or 'PRODUCTION'. Falling back to 'DEVELOPMENT' mode."); } }

Target:
public KieServerImpl(KieServerStateRepository stateRepository) { this.repository = stateRepository; String modeParam = System.getProperty(KieServerConstants.KIE_SERVER_MODE, KieServerMode.DEVELOPMENT.toString()); try { mode = KieServerMode.valueOf(modeParam.toUpperCase()); logger.info("Starting server in '" + mode.name() + "' mode."); } catch (Exception ex) { mode = KieServerMode.DEVELOPMENT; logger.warn("Unable to parse value of " + KieServerConstants.KIE_SERVER_MODE + " = " + modeParam + "; supported values are 'DEVELOPMENT' or 'PRODUCTION'. Falling back to 'DEVELOPMENT' mode."); } }
Source:
public Image loadImage(String fileName) { File fin = new File(fileName); if (!fin.exists()) { System.out.println(String.format("Trying to load image for a non-existent file! Path: %s", fileName)); return null; } Image result = Toolkit.getDefaultToolkit().getImage(fileName); if (result == null) { return null; } final boolean isAnimated = waitUntilLoaded(result); if ((result.getWidth(null) == -1) || (result.getHeight(null) == -1)) { return null; } return isAnimated ? result : ImageUtil.createAcceleratedImage(result); }

Target:
public Image loadImage(String fileName) { File fin = new File(fileName); if (!fin.exists()) { System.out.println(String.format("Trying to load image for a non-existent file! Path: %s", fileName)); return null; } Image result = Toolkit.getDefaultToolkit().getImage(fileName); if (result == null) { return null; } final boolean isAnimated = waitUntilLoaded(result); if ((result.getWidth(null) < 0) || (result.getHeight(null) < 0)) { return null; } return isAnimated ? result : ImageUtil.createAcceleratedImage(result); }
Source:
public DataFetcherResult getRecords(int maxRecords) { if (!isInitialized) { throw new IllegalArgumentException("KinesisDataFetcher.getRecords called before initialization."); } if (nextIterator != null) { try { GetRecordsResult getRecordsResult = kinesisProxy.get(nextIterator, maxRecords); LOG.info("Successfully fetched records from Kinesis for shard " + shardId + ": " + getRecordsResult); return new AdvancingResult(getRecordsResult); } catch (ResourceNotFoundException e) { LOG.info("Caught ResourceNotFoundException when fetching records for shard " + shardId); return TERMINAL_RESULT; } } else { LOG.info("Cannot fetch records from Kinesis for shard " + shardId + ": nextIterator is null."); return TERMINAL_RESULT; } }

Target:
public DataFetcherResult getRecords(int maxRecords) { if (!isInitialized) { throw new IllegalArgumentException("KinesisDataFetcher.getRecords called before initialization."); } if (nextIterator != null) { try { return new AdvancingResult(kinesisProxy.get(nextIterator, maxRecords)); } catch (ResourceNotFoundException e) { LOG.info("Caught ResourceNotFoundException when fetching records for shard " + shardId); return TERMINAL_RESULT; } } else { LOG.info("Skipping fetching records from Kinesis for shard " + shardId + ": nextIterator is null."); return TERMINAL_RESULT; } }
Source:
public void readValueAndWriteValueShouldBeSymmetric() throws IOException { final TypeSerializerRegistry registry = TypeSerializerRegistry.build() .addCustomType(SamplePerson.class, new SamplePersonSerializer()).create(); final GraphBinaryReader reader = new GraphBinaryReader(registry); final GraphBinaryWriter writer = new GraphBinaryWriter(registry); final SamplePerson person = new SamplePerson("Matias", Date.from(LocalDateTime.of(2005, 8, 5, 1, 0).toInstant(ZoneOffset.UTC))); for (boolean nullable: new boolean[] { true, false }) { final Buffer buffer = bufferFactory.create(allocator.buffer()); writer.writeValue(person, buffer, nullable); final SamplePerson actual = reader.readValue(buffer, SamplePerson.class, nullable); Assert.assertTrue(new ReflectionEquals(person).matches(actual)); buffer.release(); } }

Target:
public void readValueAndWriteValueShouldBeSymmetric() throws IOException { final TypeSerializerRegistry registry = TypeSerializerRegistry.build() .addCustomType(SamplePerson.class, new SamplePersonSerializer()).create(); final GraphBinaryReader reader = new GraphBinaryReader(registry); final GraphBinaryWriter writer = new GraphBinaryWriter(registry); final SamplePerson person = new SamplePerson("Matias", Date.from(LocalDateTime.of(2005, 8, 5, 1, 0).toInstant(ZoneOffset.UTC))); for (boolean nullable: new boolean[] { true, false }) { final Buffer buffer = bufferFactory.create(allocator.buffer()); writer.writeValue(person, buffer, nullable); final SamplePerson actual = reader.readValue(buffer, SamplePerson.class, nullable); assertThat(actual, new ReflectionEquals(person)); buffer.release(); } }
Source:
public void updateUnauthorized() throws Exception { context.turnOffAuthorisationSystem(); MetadataField metadataField = MetadataFieldBuilder.createMetadataField(context, ELEMENT, QUALIFIER, SCOPE_NOTE) .build(); MetadataFieldRest metadataFieldRest = new MetadataFieldRest(); metadataFieldRest.setId(metadataField.getID()); metadataFieldRest.setElement(ELEMENT_UPDATED); metadataFieldRest.setQualifier(QUALIFIER_UPDATED); metadataFieldRest.setScopeNote(SCOPE_NOTE_UPDATED); getClient() .perform(put("/api/core/metadatafields/" + metadataField.getID()) .content(new ObjectMapper().writeValueAsBytes(metadataFieldRest)) .contentType(contentType)) .andExpect(status().isUnauthorized()); getClient().perform(get("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", MetadataFieldMatcher.matchMetadataFieldByKeys( metadataSchema.getName(), ELEMENT, QUALIFIER) )); }

Target:
public void updateUnauthorized() throws Exception { context.turnOffAuthorisationSystem(); MetadataField metadataField = MetadataFieldBuilder.createMetadataField(context, ELEMENT, QUALIFIER, SCOPE_NOTE) .build(); context.restoreAuthSystemState(); MetadataFieldRest metadataFieldRest = new MetadataFieldRest(); metadataFieldRest.setId(metadataField.getID()); metadataFieldRest.setElement(ELEMENT_UPDATED); metadataFieldRest.setQualifier(QUALIFIER_UPDATED); metadataFieldRest.setScopeNote(SCOPE_NOTE_UPDATED); getClient() .perform(put("/api/core/metadatafields/" + metadataField.getID()) .content(new ObjectMapper().writeValueAsBytes(metadataFieldRest)) .contentType(contentType)) .andExpect(status().isUnauthorized()); getClient().perform(get("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", MetadataFieldMatcher.matchMetadataFieldByKeys( metadataSchema.getName(), ELEMENT, QUALIFIER) )); }
Source:
public void convert() throws IOException { Result sourceDataset = documentEntity(EXT_IDENTIFIERS); DataSetReference metadata = converter.convert(sourceDataset); assertNotNull(metadata); assertEquals(ID, metadata.getId()); assertEquals(EXT_ID_TYPE_DOI_UPPERCASED.toLowerCase(), metadata.getReferenceType()); assertEquals(EXT_IDENTIFIERS.get(EXT_ID_TYPE_DOI_UPPERCASED), metadata.getIdForGivenType()); assertEquals(1, metadata.getCreatorNames().size()); assertEquals(FULL_NAME, metadata.getCreatorNames().get(0)); assertEquals(2, metadata.getTitles().size()); assertEquals(TITLE, metadata.getTitles().get(0)); assertEquals(OTHER_TITLE, metadata.getTitles().get(1)); assertEquals(ABSTRACT, metadata.getDescription()); assertEquals(PUBLISHER, metadata.getPublisher()); assertEquals(YEAR, metadata.getPublicationYear()); assertEquals(1, metadata.getFormats().size()); assertEquals(FORMAT, metadata.getFormats().iterator().next()); assertEquals(RESOURCE_TYPE_CLASSID, metadata.getResourceTypeValue()); assertEquals(2, metadata.getAlternateIdentifiers().size()); assertEquals(EXT_IDENTIFIERS, metadata.getAlternateIdentifiers()); }

Target:
public void convert() { Result sourceDataset = documentEntity(EXT_IDENTIFIERS); DataSetReference metadata = converter.convert(sourceDataset); assertNotNull(metadata); assertEquals(ID, metadata.getId()); assertEquals(EXT_ID_TYPE_DOI_UPPERCASED.toLowerCase(), metadata.getReferenceType()); assertEquals(EXT_IDENTIFIERS.get(EXT_ID_TYPE_DOI_UPPERCASED), metadata.getIdForGivenType()); assertEquals(1, metadata.getCreatorNames().size()); assertEquals(FULL_NAME, metadata.getCreatorNames().get(0)); assertEquals(2, metadata.getTitles().size()); assertEquals(TITLE, metadata.getTitles().get(0)); assertEquals(OTHER_TITLE, metadata.getTitles().get(1)); assertEquals(ABSTRACT, metadata.getDescription()); assertEquals(PUBLISHER, metadata.getPublisher()); assertEquals(YEAR, metadata.getPublicationYear()); assertEquals(1, metadata.getFormats().size()); assertEquals(FORMAT, metadata.getFormats().iterator().next()); assertEquals(RESOURCE_TYPE_CLASSID, metadata.getResourceTypeValue()); assertEquals(2, metadata.getAlternateIdentifiers().size()); assertEquals(EXT_IDENTIFIERS, metadata.getAlternateIdentifiers()); }
Source:
public static <G, K, V> Map<G, Map<? extends K, ? extends V>> groupBy( Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure<G> closure) { final Map<G, List<Map.Entry<? extends K, ? extends V>>> initial = groupEntriesBy(self, closure); final Map<G, Map<? extends K, ? extends V>> answer = new LinkedHashMap<G, Map<? extends K, ? extends V>>(); for (Map.Entry<G, List<Map.Entry<? extends K, ? extends V>>> outer : initial.entrySet()) { G key = outer.getKey(); List<Map.Entry<? extends K, ? extends V>> entries = outer.getValue(); Map<K, V> target = createSimilarMap(self); putAll(target, entries); answer.put(key, target); } return answer; }

Target:
public static <G, K, V> Map<G, Map<K, V>> groupBy(Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure<G> closure) { final Map<G, List<Map.Entry<K, V>>> initial = groupEntriesBy(self, closure); final Map<G, Map<K, V>> answer = new LinkedHashMap<G, Map<K, V>>(); for (Map.Entry<G, List<Map.Entry<K, V>>> outer : initial.entrySet()) { G key = outer.getKey(); List<Map.Entry<K, V>> entries = outer.getValue(); Map<K, V> target = createSimilarMap(self); for (Map.Entry<K, V> entry : entries) { target.put(entry.getKey(), entry.getValue()); } answer.put(key, target); } return answer; }
Source:
public String openBrowser(String url, String... args) { String browserName = robot.getParamsValue(args, 0, "firefox"); String alias = robot.getParamsValue(args, 1, "None"); String remoteUrl = robot.getParamsValue(args, 2, "None"); String desiredCapabilities = robot.getParamsValue(args, 3, "None"); String browserOptions = robot.getParamsValue(args, 4, "None"); String webDriverManager = robot.getParamsValue(args, 5, "None"); if (!webDriverManager.equals("None")) { webDriverManagerSetup(browserName); } try { logging.info("browserName: " + browserName); WebDriver webDriver = createWebDriver(browserName, desiredCapabilities, remoteUrl, browserOptions); webDriver.get(url); String sessionId = webDriverCache.register(webDriver, alias); logging.debug(String.format("Opened browser with session id %s", sessionId)); return sessionId; } catch (Throwable t) { if (remoteUrl != null && !remoteUrl.equalsIgnoreCase("FALSE") && !remoteUrl.equalsIgnoreCase("NONE")) { logging.warn(String.format("Opening browser '%s' to base url '%s' through remote server at '%s' failed", browserName, url, remoteUrl)); } else { logging.warn(String.format("Opening browser '%s' to base url '%s' failed", browserName, url)); } throw new SeleniumLibraryFatalException(t); } }

Target:
public String openBrowser(String url, String... args) { String browserName = robot.getParamsValue(args, 0, "firefox"); String alias = robot.getParamsValue(args, 1, "None"); String remoteUrl = robot.getParamsValue(args, 2, "None"); String desiredCapabilities = robot.getParamsValue(args, 3, "None"); String browserOptions = robot.getParamsValue(args, 4, "None"); boolean isWebDriverManager = robot.getParamsValue(args, 5, false); if (isWebDriverManager) { webDriverManagerSetup(browserName); } try { logging.info("browserName: " + browserName); WebDriver webDriver = createWebDriver(browserName, desiredCapabilities, remoteUrl, browserOptions); webDriver.get(url); String sessionId = webDriverCache.register(webDriver, alias); logging.debug(String.format("Opened browser with session id %s", sessionId)); return sessionId; } catch (Throwable t) { if (remoteUrl != null && !remoteUrl.equalsIgnoreCase("FALSE") && !remoteUrl.equalsIgnoreCase("NONE")) { logging.warn(String.format("Opening browser '%s' to base url '%s' through remote server at '%s' failed", browserName, url, remoteUrl)); } else { logging.warn(String.format("Opening browser '%s' to base url '%s' failed", browserName, url)); } throw new SeleniumLibraryFatalException(t); } }
Source:
private boolean checkAll(HttpServletRequest request, String cache, Nameable entity, Predicate<IAuthorizationPlugin> predicate) { if (stack == null) { return true; } Statistics stats = RuntimeEnvironment.getInstance().getStatistics(); Boolean val; Map<String, Boolean> m = (Map<String, Boolean>) request.getAttribute(cache); if (m == null) { m = new TreeMap<>(); } else if ((val = m.get(entity.getName())) != null) { stats.addRequest(request, "authorization_cache_hits"); return val; } stats.addRequest(request, "authorization_cache_misses"); long time = System.currentTimeMillis(); boolean overallDecision = performCheck(entity, predicate); stats.addRequestTime(request, "authorization", System.currentTimeMillis() - time); stats.addRequestTime(request, "authorization_of_" + entity.getName(), System.currentTimeMillis() - time); m.put(entity.getName(), overallDecision); request.setAttribute(cache, m); return overallDecision; }

Target:
private boolean checkAll(HttpServletRequest request, String cache, Nameable entity, Predicate<IAuthorizationPlugin> predicate) { if (stack == null) { return true; } Statistics stats = RuntimeEnvironment.getInstance().getStatistics(); Boolean val; Map<String, Boolean> m = (Map<String, Boolean>) request.getAttribute(cache); if (m == null) { m = new TreeMap<>(); } else if ((val = m.get(entity.getName())) != null) { stats.addRequest(request, "authorization_cache_hits"); return val; } stats.addRequest(request, "authorization_cache_misses"); long time = System.currentTimeMillis(); boolean overallDecision = performCheck(entity, predicate); time = System.currentTimeMillis() - time; stats.addRequestTime(request, "authorization", time); stats.addRequestTime(request, String.format("authorization_%s", overallDecision ? "positive" : "negative"), time); stats.addRequestTime(request, String.format("authorization_%s_of_%s", overallDecision ? "positive" : "negative", entity.getName()), time); stats.addRequestTime(request, String.format("authorization_of_%s", entity.getName()), time); m.put(entity.getName(), overallDecision); request.setAttribute(cache, m); return overallDecision; }
Source:
public void setPortletDefinitionRegistry(final IPortletDefinitionRegistry portletDefinitionRegistry) { Validate.notNull(portletDefinitionRegistry, "Pportlet definition registry must not be null."); this.portletDefinitionRegistry = portletDefinitionRegistry; }

Target:
public void setPortletDefinitionRegistry(final IPortletDefinitionRegistry portletDefinitionRegistry) { Validate.notNull(portletDefinitionRegistry, "Portlet definition registry must not be null."); this.portletDefinitionRegistry = portletDefinitionRegistry; }
Source:
protected void validateFileDescriptions() { int fileUploadSize = 0; if (null != this.getFileUpload()) { fileUploadSize = this.getFileUpload().size(); } for (int i = 0; i < fileUploadSize; i++) { if (null != fileDescriptions) { if (!(fileDescriptions.get(i).length() > 0)) { this.addFieldError(DESCR_FIELD + i, this.getText("error.resource.file.descrEmpty")); } if (fileDescriptions.get(i).length() > 250) { this.addFieldError(DESCR_FIELD + i, this.getText("error.resource.file.descrTooLong")); } } else { this.addFieldError(DESCR_FIELD + i, this.getText("error.resource.file.descrEmpty")); } } }

Target:
protected void validateFileDescriptions() { int fileUploadSize = 0; if (null != this.getFileUpload()) { fileUploadSize = this.getFileUpload().size(); } for (int i = 0; i < fileUploadSize; i++) { if (null != fileDescriptions) { if (!(fileDescriptions.get(i).length() > 0)) { logger.debug("Description empty for the field ", DESCR_FIELD + i); this.addFieldError(DESCR_FIELD + i, this.getText("error.resource.file.descrEmpty")); } if (fileDescriptions.get(i).length() > 250) { logger.debug("Description too long for the field ", DESCR_FIELD + i); this.addFieldError(DESCR_FIELD + i, this.getText("error.resource.file.descrTooLong")); } } else { logger.debug("Description empty for the field ", DESCR_FIELD + i); this.addFieldError(DESCR_FIELD + i, this.getText("error.resource.file.descrEmpty")); } } }
Source:
@Test public void testTranslate3() { checkWholeExpFails("translate('aabbcc', 'ab', '+-')", "No match found for function signature TRANSLATE3\\(<CHARACTER>, <CHARACTER>, <CHARACTER>\\)"); tester = tester.withOperatorTable( ChainedSqlOperatorTable.of(SqlDialectOperatorTableFactory .instance() .getOperatorTable(SqlDialect.Dialect.ORACLE), SqlStdOperatorTable.instance())); checkExpType("translate('aabbcc', 'ab', '+-')", "VARCHAR(6) NOT NULL"); checkWholeExpFails("translate('abc', 'ab')", "Invalid number of arguments to function 'TRANSLATE3'. Was expecting 3 arguments"); checkWholeExpFails("translate('abc', 'ab', 123)", "(?s)Cannot apply 'TRANSLATE3' to arguments of type 'TRANSLATE3\\(<CHAR\\(3\\)>, <CHAR\\(2\\)>, <INTEGER>\\)'\\. .*"); checkWholeExpFails("translate('abc', 'ab', '+-', 'four')", "Invalid number of arguments to function 'TRANSLATE3'. Was expecting 3 arguments"); }

Target:
@Test public void testTranslate3() { checkWholeExpFails("translate('aabbcc', 'ab', '+-')", "No match found for function signature TRANSLATE3\\(<CHARACTER>, <CHARACTER>, <CHARACTER>\\)"); tester = tester.withOperatorTable( ChainedSqlOperatorTable .of(SqlDialectOperatorTableFactory .instance() .getOperatorTable(SqlFlavor.Flavor.ORACLE), SqlStdOperatorTable.instance())); checkExpType("translate('aabbcc', 'ab', '+-')", "VARCHAR(6) NOT NULL"); checkWholeExpFails("translate('abc', 'ab')", "Invalid number of arguments to function 'TRANSLATE3'. Was expecting 3 arguments"); checkWholeExpFails("translate('abc', 'ab', 123)", "(?s)Cannot apply 'TRANSLATE3' to arguments of type 'TRANSLATE3\\(<CHAR\\(3\\)>, <CHAR\\(2\\)>, <INTEGER>\\)'\\. .*"); checkWholeExpFails("translate('abc', 'ab', '+-', 'four')", "Invalid number of arguments to function 'TRANSLATE3'. Was expecting 3 arguments"); }
Source:
public void setExpressionStatement(ExpressionStatement expr) { if (!(expr instanceof ReferenceLookup || expr instanceof FunctionInvocation || expr instanceof ClosureReference || (expr instanceof BinaryOperation && ((BinaryOperation) expr).getType().equals(OperatorType.ANON_CALL)))) { throw new IllegalArgumentException("Decorator expression must be a reference or an invocation, got a " + expr.getClass().getSimpleName()); } this.expressionStatement = expr; makeParentOf(expr); }

Target:
public void setExpressionStatement(ExpressionStatement expr) { if (!isValidDecoratorExpressoin(expr)) { throw new IllegalArgumentException("Decorator expression must be a reference or an invocation, got a " + expr.getClass().getSimpleName()); } this.expressionStatement = expr; makeParentOf(expr); }
Source:
public static Test setUpTest(Test test) { return new Java17ProjectTestSetup(test); }

Target:
public static Test setUpTest(Test test) { return new Java1d5ProjectTestSetup(test); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Address)) { return false; } final Address address = (Address) o; return this.type == address.type && this.socketAddr.equals(address.socketAddr); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Address)) { return false; } final Address address = (Address) o; return port == address.port && inetAddress.equals(address.inetAddress); }
Source:
private static Long parseDateToEpochSeconds(String dateTime) { ClientLogger logger = new ClientLogger(MSIToken.class); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy H:mm:ss XXX", Locale.US); DateTimeFormatter dtf_windows = DateTimeFormatter.ofPattern("M/d/yyyy K:mm:ss a XXX", Locale.US); try { return Long.parseLong(dateTime); } catch (NumberFormatException e) { logger.error(e.getMessage()); } try { return Instant.from(dtf.parse(dateTime)).getEpochSecond(); } catch (DateTimeParseException e) { logger.error(e.getMessage()); } try { return Instant.from(dtf_windows.parse(dateTime)).getEpochSecond(); } catch (DateTimeParseException e) { logger.error(e.getMessage()); } throw logger.logExceptionAsError(new IllegalArgumentException("Unable to parse date time " + dateTime)); }

Target:
private static Long parseDateToEpochSeconds(String dateTime) { ClientLogger logger = new ClientLogger(MSIToken.class); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy H:mm:ss XXX"); DateTimeFormatter dtfWindows = DateTimeFormatter.ofPattern("M/d/yyyy K:mm:ss a XXX"); try { return Long.parseLong(dateTime); } catch (NumberFormatException e) { logger.error(e.getMessage()); } try { return Instant.from(dtf.parse(dateTime)).getEpochSecond(); } catch (DateTimeParseException e) { logger.error(e.getMessage()); } try { return Instant.from(dtfWindows.parse(dateTime)).getEpochSecond(); } catch (DateTimeParseException e) { logger.error(e.getMessage()); } throw logger.logExceptionAsError(new IllegalArgumentException("Unable to parse date time " + dateTime)); }
Source:
public void add(final RevCommit c) { sinceLastIndex++; if (++inQueue > REBUILD_INDEX_COUNT && sinceLastIndex > REBUILD_INDEX_COUNT) { sinceLastIndex = 0; buildIndex(); } Entry q = head; final long when = c.commitTime; if (!index.isEmpty()) { Entry prev = null; for (Entry i : index) { if (when > i.commit.commitTime) { if (prev != null) { q = prev; } break; } prev = i; } } final Entry n = newEntry(c); if (q == null || when > q.commit.commitTime) { n.next = q; head = n; } else { Entry p = q.next; while (p != null && p.commit.commitTime > when) { q = p; p = q.next; } n.next = q.next; q.next = n; } }

Target:
public void add(final RevCommit c) { sinceLastIndex++; if (++inQueue > REBUILD_INDEX_COUNT && sinceLastIndex > REBUILD_INDEX_COUNT) { sinceLastIndex = 0; buildIndex(); } Entry q = head; final long when = c.commitTime; if (!index.isEmpty()) { Entry prev = null; for (Entry i : index) { if (when > i.commit.commitTime) { if (prev != null) q = prev; break; } prev = i; } } final Entry n = newEntry(c); if (q == null || when > q.commit.commitTime) { n.next = q; head = n; } else { Entry p = q.next; while (p != null && p.commit.commitTime > when) { q = p; p = q.next; } n.next = q.next; q.next = n; } }