auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public DynamicTableSource createDynamicTableSource(Context context) { FactoryUtil.TableFactoryHelper helper = FactoryUtil.createTableFactoryHelper(this, context); ReadableConfig tableOptions = helper.getOptions(); DecodingFormat<DeserializationSchema<RowData>> decodingFormat = helper.discoverDecodingFormat( DeserializationFormatFactory.class, FactoryUtil.FORMAT); Optional<String> topic = tableOptions.getOptional(TOPIC); Optional<String> pattern = tableOptions.getOptional(TOPIC_PATTERN); helper.validateExcept(PROPERTIES_PREFIX); validateTableOptions(tableOptions); DataType producedDataType = context.getCatalogTable().getSchema().toPhysicalRowDataType(); final StartupOptions startupOptions = getStartupOptions(tableOptions); final Properties properties = getKafkaProperties(context.getCatalogTable().getOptions()); properties.setProperty(FlinkKafkaConsumerBase.KEY_PARTITION_DISCOVERY_INTERVAL_MILLIS, String.valueOf(tableOptions .getOptional(SCAN_TOPIC_PARTITION_DISCOVERY) .map(val -> val.toMillis()) .orElse(FlinkKafkaConsumerBase.PARTITION_DISCOVERY_DISABLED))); return createKafkaTableSource( producedDataType, topic.map(value -> Arrays .stream(value.split(",")) .map(String::trim) .collect(Collectors.toList())) .orElse(null), pattern.map(value -> Pattern.compile(value)).orElse(null), properties, decodingFormat, startupOptions.startupMode, startupOptions.specificOffsets, startupOptions.startupTimestampMillis); }

Target:
public DynamicTableSource createDynamicTableSource(Context context) { FactoryUtil.TableFactoryHelper helper = FactoryUtil.createTableFactoryHelper(this, context); ReadableConfig tableOptions = helper.getOptions(); DecodingFormat<DeserializationSchema<RowData>> decodingFormat = helper.discoverDecodingFormat( DeserializationFormatFactory.class, FactoryUtil.FORMAT); helper.validateExcept(PROPERTIES_PREFIX); validateTableSourceOptions(tableOptions); DataType producedDataType = context.getCatalogTable().getSchema().toPhysicalRowDataType(); final StartupOptions startupOptions = getStartupOptions(tableOptions); final Properties properties = getKafkaProperties(context.getCatalogTable().getOptions()); properties.setProperty(FlinkKafkaConsumerBase.KEY_PARTITION_DISCOVERY_INTERVAL_MILLIS, String.valueOf(tableOptions .getOptional(SCAN_TOPIC_PARTITION_DISCOVERY) .map(Duration::toMillis) .orElse(FlinkKafkaConsumerBase.PARTITION_DISCOVERY_DISABLED))); return createKafkaTableSource( producedDataType, KafkaOptions.getSourceTopics(tableOptions), KafkaOptions.getSourceTopicPattern(tableOptions), properties, decodingFormat, startupOptions.startupMode, startupOptions.specificOffsets, startupOptions.startupTimestampMillis); }
Source:
private Set<IGroupMember> primGetAllMembers(Set<IGroupMember> rslt) throws GroupsException { final Set<IGroupMember> members = getChildren(); for (IGroupMember gm : members) { rslt.add(gm); if (gm.isGroup()) { ((EntityGroupImpl) gm).primGetAllMembers(rslt); } } return rslt; }

Target:
private Set<IGroupMember> primGetAllMembers(Set<IGroupMember> rslt) throws GroupsException { for (IGroupMember gm : getChildren()) { rslt.add(gm); if (gm.isGroup()) { ((EntityGroupImpl) gm).primGetAllMembers(rslt); } } return rslt; }
Source:
protected Class<?> loadRepositoryInterface(RepositoryConfiguration<?> configuration, ResourceLoader loader) { String repositoryInterface = configuration.getRepositoryInterface(); ClassLoader classLoader = loader.getClassLoader(); try { return org.springframework.util.ClassUtils.forName(repositoryInterface, classLoader); } catch (ClassNotFoundException | LinkageError e) { LOGGER.warn(String.format(CLASS_LOADING_ERROR, getModuleName(), repositoryInterface, classLoader), e); } return null; }

Target:
private Class<?> loadRepositoryInterface(RepositoryConfiguration<?> configuration, ResourceLoader loader) { String repositoryInterface = configuration.getRepositoryInterface(); ClassLoader classLoader = loader.getClassLoader(); try { return org.springframework.util.ClassUtils.forName(repositoryInterface, classLoader); } catch (ClassNotFoundException | LinkageError e) { LOGGER.warn(String.format(CLASS_LOADING_ERROR, getModuleName(), repositoryInterface, classLoader), e); } return null; }
Source:
public Schema<ChangeData> getSchema() { return null; }

Target:
public Schema<ChangeData> getSchema() { throw new UnsupportedOperationException(); }
Source:
public Timestamp fromLong(Long microsFromEpoch, Schema schema, LogicalType type) { java.sql.Timestamp ts = new java.sql.Timestamp(microsFromEpoch / 1000); int micros = (int) (microsFromEpoch - (microsFromEpoch / 1000000 * 1000000)); ts.setNanos(micros * 1000); return Timestamp.newBuilder() .setSeconds(ts.getTime() / 1000) .setNanos(ts.getNanos()) .build(); }

Target:
public Timestamp fromLong(Long microsFromEpoch, Schema schema, LogicalType type) throws IllegalArgumentException { return ProtoConversions.fromLong(microsFromEpoch, TimestampPrecise.Micros); }
Source:
private static Map<String, String[]> getXdocsMap() { final String rootPath = getRootPath(); final File checks = new File(rootPath + "/" + PACKAGE_NAME); final String[] checksSubDirNames = checks.list((rootDir, pathname) -> { return !pathname.endsWith(SUFFIX_JAVA); }); final Map<String, String[]> checksNamesMap = new HashMap<>(); if (checksSubDirNames != null) { for (String dirName : checksSubDirNames) { final File dirFile = new File(rootPath + "/" + PACKAGE_NAME + "/" + dirName); final String[] fileNames = dirFile.list((rootDir, pathname) -> { return pathname.endsWith(SUFFIX_CHECK_JAVA); }); checksNamesMap.put(dirName, fileNames); } final String[] miscNames = checks.list((rootDir, pathname) -> { return pathname.endsWith(SUFFIX_CHECK_JAVA); }); checksNamesMap.put(MISC, miscNames); } return checksNamesMap; }

Target:
private static Map<String, List<String>> getXdocsMap() throws IOException { final Map<String, List<String>> checksNamesMap = new HashMap<>(); final Set<Class<?>> checkSet = CheckUtil.getCheckstyleModules(); final Set<Class<?>> treeWalkerOrFileSetCheckSet = checkSet.stream() .filter(clazz -> { return AbstractCheck.class.isAssignableFrom(clazz) || AbstractFileSetCheck.class.isAssignableFrom(clazz); }) .collect(Collectors.toSet()); for (Class<?> check : treeWalkerOrFileSetCheckSet) { final String checkName = check.getSimpleName(); if (!checkName.equals(TREE_WORKER)) { String packageName = check.getPackage().getName(); packageName = packageName.substring(packageName.lastIndexOf('.') + 1); if (packageName.equals(CHECKS)) { packageName = MISC; } if (checksNamesMap.get(packageName) == null) { final List<String> arrayList = new ArrayList<>(); arrayList.add(checkName); checksNamesMap.put(packageName, arrayList); } else { checksNamesMap.get(packageName).add(checkName); } } } return checksNamesMap; }
Source:
private void updateInputProperties(String instance, String property) { for (DenonBindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { DenonBindingConfig cfg = provider.getConfig(itemName); if (cfg.getInstance().equals(instance)) { if (cfg.getProperty().startsWith("SI") && !cfg.getProperty().equals(property)) { updateIfChanged(cfg.getInstance(), cfg.getProperty(), OnOffType.OFF); } } } } }

Target:
private void updateInputProperties(String instance, String property) { for (DenonBindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { DenonBindingConfig cfg = provider.getConfig(itemName); if (cfg.getInstance().equals(instance)) { if (cfg.getProperty().startsWith(SWITCH_INPUT) && !cfg.getProperty().equals(property)) { updateIfChanged(cfg.getInstance(), cfg.getProperty(), OnOffType.OFF); } } } } }
Source:
public void testEncryptAndSignWithoutSignerSecretKey() throws Exception { String msg = "Test Message"; PGPEncryptAndSignInfo encryptAndSignInfo = new PGPEncryptAndSignInfo("Robert Plant <robert@cambridge.edu.uk>"); kbStrategy.setCredentialsAccessor(new FakeCredentialAccessor("Mule client <mule_client@mule.com>")); kbStrategy.initialise(); try { kbStrategy.encrypt(msg.getBytes(), encryptAndSignInfo); fail("CryptoFailureException should be triggered because signer private key is not present"); } catch (CryptoFailureException e) { assertThat(e.getMessage(), startsWith("Crypto Failure: Signer private key not found for principal:")); } }

Target:
public void testEncryptAndSignWithoutSignerSecretKey() throws Exception { String msg = "Test Message"; PGPEncryptAndSignInfo encryptAndSignInfo = new PGPEncryptAndSignInfo("Robert Plant <robert@cambridge.edu.uk>"); kbStrategy.setCredentialsAccessor(new FakeCredentialAccessor("Mule client <mule_client@mule.com>")); kbStrategy.initialise(); try { kbStrategy.encrypt(msg.getBytes(), encryptAndSignInfo); fail("CryptoFailureException should be triggered because signer private key is not present"); } catch (CryptoFailureException e) { assertThat(e.getMessage(), startsWith(EXPECTED_NO_SIGNER_PRIVATE_KEY_ERROR_MESSAGE)); } }
Source:
public void renameInternal(Path src, Path dst, boolean overwrite) throws AccessControlException, FileAlreadyExistsException, FileNotFoundException, ParentNotDirectoryException, UnresolvedLinkException, IOException { Options.Rename renameOpt = Options.Rename.NONE; if (overwrite) { renameOpt = Options.Rename.OVERWRITE; } final Options.Rename opt = renameOpt; renameInternal(src, dst, (s, d) -> getMyFs().rename(s, d, opt)); }

Target:
public void renameInternal(Path src, Path dst, boolean overwrite) throws AccessControlException, FileAlreadyExistsException, FileNotFoundException, ParentNotDirectoryException, UnresolvedLinkException, IOException { Options.Rename renameOpt = Options.Rename.NONE; if (overwrite) { renameOpt = Options.Rename.OVERWRITE; } if (isDirectory(src)) { getMyFs().rename(src, dst, renameOpt); } else { getMyFs().rename(src, dst, renameOpt); Path checkFile = getChecksumFile(src); if (exists(checkFile)) { if (isDirectory(dst)) { getMyFs().rename(checkFile, dst, renameOpt); } else { getMyFs().rename(checkFile, getChecksumFile(dst), renameOpt); } } } }
Source:
public static boolean setSchedulerLocation( Config runtime, String schedulerEndpoint, IScheduler scheduler) { Scheduler.SchedulerLocation.Builder builder = Scheduler.SchedulerLocation.newBuilder() .setTopologyName(Runtime.topologyName(runtime)) .setHttpEndpoint(schedulerEndpoint); List<String> jobLinks = scheduler.getJobLinks(); if (jobLinks != null) { builder.addAllJobPageLink(jobLinks); } Scheduler.SchedulerLocation location = builder.build(); LOG.log(Level.INFO, "Setting Scheduler locations:\n{0}", location); SchedulerStateManagerAdaptor statemgr = Runtime.schedulerStateManagerAdaptor(runtime); Boolean result = statemgr.setSchedulerLocation(location, Runtime.topologyName(runtime)); if (result == null || !result) { LOG.severe("Failed to set Scheduler location"); return false; } return true; }

Target:
public static boolean setSchedulerLocation( Config runtime, String schedulerEndpoint, IScheduler scheduler) { Scheduler.SchedulerLocation.Builder builder = Scheduler.SchedulerLocation.newBuilder() .setTopologyName(Runtime.topologyName(runtime)) .setHttpEndpoint(schedulerEndpoint); List<String> jobLinks = scheduler.getJobLinks(); if (jobLinks != null) { builder.addAllJobPageLink(jobLinks); } Scheduler.SchedulerLocation location = builder.build(); LOG.log(Level.INFO, "Setting Scheduler locations: {0}", location); SchedulerStateManagerAdaptor statemgr = Runtime.schedulerStateManagerAdaptor(runtime); Boolean result = statemgr.setSchedulerLocation(location, Runtime.topologyName(runtime)); if (result == null || !result) { LOG.severe("Failed to set Scheduler location"); return false; } return true; }
Source:
private void updateRecord(final AccessRecord record, final String file, final int line, final UpdateRecordCallback callback) { List<Runnable> tasks = new ArrayList<Runnable>(); MetricCollection metricCollection = new MetricCollection(); for (final Metric<AccessRecord, ?> metric : metricCollection) { if (!ignoreMetrics.contains(metric.getName())) { tasks.add(new Runnable() { @Override public void run() { try { metric.write(record); } catch (Throwable e){ callback.handle(new WriteRecordResult(false, metric.getName(), file, line)); } } }); } } for (Runnable task : tasks) { threadPool.submit(task); } }

Target:
private void updateRecord(final AccessRecord record, final String file, final int line, final UpdateRecordCallback callback) { List<Runnable> tasks = new ArrayList<Runnable>(); for (final Metric<AccessRecord, ?> metric : metricCollection) { if (!ignoreMetrics.contains(metric.getName())) { tasks.add(new Runnable() { @Override public void run() { try { metric.write(record); } catch (Throwable e){ callback.handle(new WriteRecordResult(false, metric.getName(), file, line)); } } }); } } for (Runnable task : tasks) { threadPool.submit(task); } }
Source:
public InstrumentationContext<List<ValidationError>> beginValidation(InstrumentationValidationParameters parameters) { return whenCompleted((errors, throwable) -> { if ((errors != null && errors.size() > 0) || throwable != null) { return; } QueryTraverser queryTraverser = newQueryTraversal(parameters); Map<QueryVisitorFieldEnvironment, Integer> valuesByParent = new LinkedHashMap<>(); queryTraverser.visitPostOrder(new QueryVisitorStub() { @Override public void visitField(QueryVisitorFieldEnvironment env) { int childsComplexity = valuesByParent.getOrDefault(env, 0); int value = calculateComplexity(env, childsComplexity); valuesByParent.compute(env.getParentEnvironment(), (key, oldValue) -> ofNullable(oldValue).orElse(0) + value ); } }); int totalComplexity = valuesByParent.getOrDefault(null, 0); log.debug("Query complexity: {}", totalComplexity); if (totalComplexity > maxComplexity) { QueryComplexityInfo queryComplexityInfo = QueryComplexityInfo.newQueryComplexityInfo() .complexity(totalComplexity) .build(); boolean throwAbortException = maxQueryComplexityExceededFunction.apply(queryComplexityInfo); if (throwAbortException) { throw mkAbortException(totalComplexity, maxComplexity); } } }); }

Target:
public InstrumentationContext<List<ValidationError>> beginValidation(InstrumentationValidationParameters parameters) { return whenCompleted((errors, throwable) -> { if ((errors != null && errors.size() > 0) || throwable != null) { return; } QueryTraverser queryTraverser = newQueryTraverser(parameters); Map<QueryVisitorFieldEnvironment, Integer> valuesByParent = new LinkedHashMap<>(); queryTraverser.visitPostOrder(new QueryVisitorStub() { @Override public void visitField(QueryVisitorFieldEnvironment env) { int childsComplexity = valuesByParent.getOrDefault(env, 0); int value = calculateComplexity(env, childsComplexity); valuesByParent.compute(env.getParentEnvironment(), (key, oldValue) -> ofNullable(oldValue).orElse(0) + value ); } }); int totalComplexity = valuesByParent.getOrDefault(null, 0); log.debug("Query complexity: {}", totalComplexity); if (totalComplexity > maxComplexity) { QueryComplexityInfo queryComplexityInfo = QueryComplexityInfo.newQueryComplexityInfo() .complexity(totalComplexity) .build(); boolean throwAbortException = maxQueryComplexityExceededFunction.apply(queryComplexityInfo); if (throwAbortException) { throw mkAbortException(totalComplexity, maxComplexity); } } }); }
Source:
BlobData getBlobData() { return blobData; }

Target:
public BlobData getBlobData() { return blobData; }
Source:
public Viewer findContentViewer(Viewer oldViewer, ICompareInput input, Composite parent) { Viewer contentViewer = super.findContentViewer(oldViewer, input, parent); if (input instanceof FileItemNode && ((FileItemNode) input).getFileItem() != null) { ReviewCompareAnnotationSupport support = ReviewCompareAnnotationSupport.getAnnotationSupport(contentViewer); support.setReviewItem(((FileItemNode) input).getFileItem(), behavior); } ToolBarManager tbm = CompareViewerPane.getToolBarManager(parent); UIUtils.insertAnnotationNavigationCommands(CompareViewerPane.getToolBarManager(parent)); return contentViewer; }

Target:
public Viewer findContentViewer(Viewer oldViewer, ICompareInput input, Composite parent) { Viewer contentViewer = super.findContentViewer(oldViewer, input, parent); if (input instanceof FileItemNode && ((FileItemNode) input).getFileItem() != null) { ReviewCompareAnnotationSupport support = ReviewCompareAnnotationSupport.getAnnotationSupport(contentViewer); support.setReviewItem(((FileItemNode) input).getFileItem(), behavior); } insertAnnotationNavigationCommands(CompareViewerPane.getToolBarManager(parent)); return contentViewer; }
Source:
public void testForARoomDisabledTheTabletDoesNotScheduleMeetings() { HomeAdminPage homePage = new HomeAdminPage(); RoomsPage confRoomPage = homePage.clickConferenceRoomsLink(); if(confRoomPage.stateEnableDisableBtn(roomName)) { confRoomPage.enableDisableIcon(roomName); } else { HomeTabletPage homeTablet = new HomeTabletPage(); SearchPage searchPage = homeTablet.clickSearchBtn(); searchPage.clickCollapseAdvancedBtn(); searchPage.setName(roomName); Assert.assertFalse(searchPage.roomIsDiplayed(roomName)); } }

Target:
public void testForARoomDisabledTheTabletDoesNotScheduleMeetings() { HomeTabletPage homeTabletPage = new HomeTabletPage(); SearchPage searchPage = homeTabletPage.clickSearchBtn() .clickCollapseAdvancedBtn() .setName(roomName); Assert.assertFalse(searchPage.roomIsDiplayed(roomName)); }
Source:
private boolean isCandidate(Map<ColumnHandle, NullableValue> bindings) { if (intersection(bindings.keySet(), arguments).isEmpty()) { return true; } LookupSymbolResolver inputs = new LookupSymbolResolver(assignments, bindings); Object optimized; try { optimized = evaluator.optimize(inputs); } catch (PrestoException e) { TryFunction.propagateIfUnhandled(e); return true; } if (Boolean.FALSE.equals(optimized) || optimized == null || optimized instanceof NullLiteral) { return false; } return true; }

Target:
private boolean isCandidate(Map<ColumnHandle, NullableValue> bindings) { if (intersection(bindings.keySet(), arguments).isEmpty()) { return true; } LookupSymbolResolver inputs = new LookupSymbolResolver(assignments, bindings); Object optimized = TryFunction.evaluate(() -> evaluator.optimize(inputs), true); if (Boolean.FALSE.equals(optimized) || optimized == null || optimized instanceof NullLiteral) { return false; } return true; }
Source:
public NodeAvailabilityStatus getNodeAvailabilityStatus() { try { readAtSpecifiedConsistency(ConsistencyLevel.ALL); return NodeAvailabilityStatus.ALL_AVAILABLE; } catch (Exception e) { try { readAtSpecifiedConsistency(ConsistencyLevel.EACH_QUORUM); return NodeAvailabilityStatus.EACH_QUORUM_AVAILABLE; } catch (Exception e1) { return tryReadWithLocalQuorum(); } } }

Target:
public NodeAvailabilityStatus getNodeAvailabilityStatus() { if (!doesConfigReplicationFactorMatchWithCluster()) { return NodeAvailabilityStatus.TERMINAL; } return getStatusByRunningOperationsOnEachHost(); }
Source:
private void recreateZKConnection() throws Exception{ try { zk.close(); } catch (InterruptedException e) { LOG.error("Error closing ZK connection : " + e); throw new RuntimeException(e) ; } finally { try { createZKConnection(newTaskCreatedWatcher); createEphemeralZNode(ChaosConstants.CHAOS_AGENT_REGISTRATION_EPIMERAL_ZNODE + ChaosConstants.ZNODE_PATH_SEPARATOR + agentName, new byte[0]); } catch (IOException e) { LOG.error("Error creating new ZK COnnection for agent: " + agentName + e); throw new RuntimeException(e); } } }

Target:
private void recreateZKConnection() throws Exception{ try { zk.close(); createZKConnection(newTaskCreatedWatcher); createEphemeralZNode(ChaosConstants.CHAOS_AGENT_REGISTRATION_EPIMERAL_ZNODE + ChaosConstants.ZNODE_PATH_SEPARATOR + agentName, new byte[0]); } catch (IOException e) { LOG.error("Error creating new ZK COnnection for agent: {}", agentName + e); throw e; } }
Source:
public static synchronized void acquireCore() { if (!SUPPORTED) { throw new RuntimeException("CPU Affinity not supported in current environment"); } if (!CpuAffinityJni.isRoot()) { throw new RuntimeException("CPU Affinity can only be set if the process is running as root"); } try { int cpu = pickAvailableCpu(); CpuAffinityJni.setAffinity(cpu); log.info("Thread has successfully acquired ownership of cpu {}", Thread.currentThread().getName(), cpu); } catch (IOException e) { throw new RuntimeException("Failed to acquire CPU core: " + e.getMessage()); } }

Target:
public static synchronized void acquireCore() { if (!isInitialized) { init(); } if (!isSupported) { throw new RuntimeException("CPU Affinity not supported in current environment"); } if (!CpuAffinityJni.isRoot()) { throw new RuntimeException("CPU Affinity can only be set if the process is running as root"); } try { int cpu = pickAvailableCpu(); CpuAffinityJni.setAffinity(cpu); log.info("Thread has successfully acquired ownership of cpu {}", Thread.currentThread().getName(), cpu); } catch (IOException e) { throw new RuntimeException("Failed to acquire CPU core: " + e.getMessage()); } }
Source:
private void openCase(Path caseMetadataFilePath) { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { StartupWindowProvider.getInstance().close(); CueBannerPanel.closeMultiUserCasesWindow(); CaseOpenMultiUserAction.closeMultiUserCasesWindow(); MultiUserCaseManager.getInstance().openCase(caseMetadataFilePath); } catch (CaseActionException | MultiUserCaseManager.MultiUserCaseManagerException ex) { if (null != ex.getCause() && !(ex.getCause() instanceof CaseActionCancelledException)) { LOGGER.log(Level.SEVERE, String.format("Error opening case with metadata file path %s", caseMetadataFilePath), ex); MessageNotifyUtil.Message.error(ex.getCause().getLocalizedMessage()); } StartupWindowProvider.getInstance().open(); } finally { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }

Target:
private void openCase(Path caseMetadataFilePath) { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { StartupWindowProvider.getInstance().close(); if (parentDialog != null) { parentDialog.setVisible(false); } MultiUserCaseManager.getInstance().openCase(caseMetadataFilePath); } catch (CaseActionException | MultiUserCaseManager.MultiUserCaseManagerException ex) { if (null != ex.getCause() && !(ex.getCause() instanceof CaseActionCancelledException)) { LOGGER.log(Level.SEVERE, String.format("Error opening case with metadata file path %s", caseMetadataFilePath), ex); MessageNotifyUtil.Message.error(ex.getCause().getLocalizedMessage()); } StartupWindowProvider.getInstance().open(); } finally { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
Source:
public static LfsPointer parseLfsPointer(InputStream in) throws IOException { boolean v = false; LongObjectId id = null; long si = -1; try (BufferedReader br = new BufferedReader( new InputStreamReader(in))) { for (String s = br.readLine(); s != null; s = br.readLine()) { if (s.startsWith("#") || s.length() == 0) continue; if (s.startsWith("version") && s.length() > 8 && s.substring(8).trim().equals(VERSION)) { v = true; } else if (s.startsWith("oid") && s.length() > 4) { if (s.startsWith("oid sha256:")) { id = LongObjectId.fromString(s.substring(11).trim()); } else { id = LongObjectId.fromString(s.substring(4).trim()); } } else if (s.startsWith("size") && s.length() > 5) { si = Long.parseLong(s.substring(5).trim()); } else { return null; } } if (v && id != null && si > -1) { return new LfsPointer(id, si); } } return null; }

Target:
public static LfsPointer parseLfsPointer(InputStream in) throws IOException { boolean versionLine = false; LongObjectId id = null; long si = -1; try (BufferedReader br = new BufferedReader( new InputStreamReader(in))) { for (String s = br.readLine(); s != null; s = br.readLine()) { if (s.startsWith("#") || s.length() == 0) { continue; } else if (s.startsWith("version") && s.length() > 8 && s.substring(8).trim().equals(VERSION)) { versionLine = true; } else if (s.startsWith("oid sha256:")) { id = LongObjectId.fromString(s.substring(11).trim()); } else if (s.startsWith("size") && s.length() > 5) { si = Long.parseLong(s.substring(5).trim()); } else { return null; } } if (versionLine && id != null && si > -1) { return new LfsPointer(id, si); } } return null; }
Source:
public void autoService() { assert_().about(javaSources()) .that(Arrays.asList( JavaFileObjects.forResource("test/SomeService.java"), JavaFileObjects.forResource("test/SomeServiceProvider1.java"), JavaFileObjects.forResource("test/SomeServiceProvider2.java"), JavaFileObjects.forResource("test/Enclosing.java"), JavaFileObjects.forResource("test/MultiServiceProvider.java"), JavaFileObjects.forResource("test/AnotherService.java"), JavaFileObjects.forResource("test/AnotherServiceProvider.java"))) .processedWith(new AutoServiceProcessor()) .compilesWithoutError() .and().generatesFiles( JavaFileObjects.forResource("META-INF/services/test.SomeService"), JavaFileObjects.forResource("META-INF/services/test.AnotherService")); }

Target:
public void autoService() { assertThat( JavaFileObjects.forResource("test/SomeService.java"), JavaFileObjects.forResource("test/SomeServiceProvider1.java"), JavaFileObjects.forResource("test/SomeServiceProvider2.java"), JavaFileObjects.forResource("test/Enclosing.java"), JavaFileObjects.forResource("test/AnotherService.java"), JavaFileObjects.forResource("test/AnotherServiceProvider.java")) .processedWith(new AutoServiceProcessor()) .compilesWithoutError() .and().generatesFiles( JavaFileObjects.forResource("META-INF/services/test.SomeService"), JavaFileObjects.forResource("META-INF/services/test.AnotherService")); }
Source:
public void put(byte[] key, byte[] value) { validateMessageSize(value); if (!isLargeMessage(value)) { store.put(key, value); } }

Target:
public void put(byte[] key, byte[] value) { validateMessageSize(value); if (!isLargeMessage(value)) { store.put(key, value); } else { LOG.info("Ignoring a large message with size " + value.length + " since it is greater than " + "the maximum allowed value of " + maxMessageSize); largeMessageSafeStoreMetrics.ignoredLargeMessages().inc(); } }
Source:
private void connect() throws SQLException { if (conn != null) { try { conn.prepareStatement("SELECT 1;").execute(); } catch (SQLException ex) { if ("08S01".equals(ex.getSQLState())) { conn.close(); } } } if (conn == null || conn.isClosed()) { conn = DriverManager.getConnection(config.sqlDsn, config.sqlUsername, config.sqlPassword); } }

Target:
private void connect() throws SQLException { if (conn != null) { try { conn.prepareStatement("SELECT 1;").execute(); } catch (SQLException ex) { if (COMM_LINK_FAILURE.equals(ex.getSQLState())) { conn.close(); } } } if (conn == null || conn.isClosed()) { conn = DriverManager.getConnection(config.sqlDsn, config.sqlUsername, config.sqlPassword); } }
Source:
public void addOscoreContext(BootstrapConfig config) { HashMapCtxDB db = OscoreHandler.getContextDB(); LOG.trace("Adding OSCORE context information to the context database"); BootstrapConfig.OscoreObject osc = null; for (Map.Entry<Integer, BootstrapConfig.OscoreObject> o : config.oscore.entrySet()) { osc = o.getValue(); try { AlgorithmID hkdfAlg; if (osc.oscoreHmacAlgorithm.matches("-?\\d+")) { hkdfAlg = AlgorithmID.FromCBOR(CBORObject.FromObject(Integer.parseInt(osc.oscoreHmacAlgorithm))); } else { hkdfAlg = AlgorithmID.valueOf(osc.oscoreHmacAlgorithm); } AlgorithmID aeadAlg; if (osc.oscoreAeadAlgorithm.matches("-?\\d+")) { aeadAlg = AlgorithmID.FromCBOR(CBORObject.FromObject(Integer.parseInt(osc.oscoreAeadAlgorithm))); } else { aeadAlg = AlgorithmID.valueOf(osc.oscoreAeadAlgorithm); } if (osc.oscoreMasterSalt.length == 0) { osc.oscoreMasterSalt = null; } if (osc.oscoreIdContext.length == 0) { osc.oscoreIdContext = null; } OSCoreCtx ctx = new OSCoreCtx(osc.oscoreMasterSecret, false, aeadAlg, osc.oscoreSenderId, osc.oscoreRecipientId, hkdfAlg, 32, osc.oscoreMasterSalt, osc.oscoreIdContext); db.addContext(ctx); } catch (OSException | CoseException e) { LOG.error("Failed to add OSCORE context to context database."); e.printStackTrace(); } } }

Target:
public void addOscoreContext(BootstrapConfig config) { HashMapCtxDB db = OscoreHandler.getContextDB(); LOG.trace("Adding OSCORE context information to the context database"); BootstrapConfig.OscoreObject osc = null; for (Map.Entry<Integer, BootstrapConfig.OscoreObject> o : config.oscore.entrySet()) { osc = o.getValue(); try { byte[] masterSecret = Hex.decodeHex(osc.oscoreMasterSecret.toCharArray()); byte[] senderId = Hex.decodeHex(osc.oscoreSenderId.toCharArray()); byte[] recipientId = Hex.decodeHex(osc.oscoreRecipientId.toCharArray()); byte[] masterSalt = Hex.decodeHex(osc.oscoreMasterSalt.toCharArray()); if (masterSalt.length == 0) { masterSalt = null; } AlgorithmID aeadAlg = AlgorithmID.FromCBOR(CBORObject.FromObject(osc.oscoreAeadAlgorithm)); AlgorithmID hkdfAlg = AlgorithmID.FromCBOR(CBORObject.FromObject(osc.oscoreHmacAlgorithm)); byte[] idContext = null; int replayWindow = 32; OSCoreCtx ctx = new OSCoreCtx(masterSecret, false, aeadAlg, senderId, recipientId, hkdfAlg, replayWindow, masterSalt, idContext); db.addContext(ctx); } catch (OSException | CoseException e) { LOG.error("Failed to add OSCORE context to context database.", e); } } }
Source:
static List<String> splitUserInput(String userInput) { List<String> splitWithWhiteSpaces = splitWithWhiteSpace(userInput); List<String> furtherSplitWithEquals = new ArrayList<>(); boolean doNotRemoveEqualsInNextToken = false; for (String token : splitWithWhiteSpaces) { if (doNotRemoveEqualsInNextToken) { furtherSplitWithEquals.add(token); doNotRemoveEqualsInNextToken = false; } else { int indexOfFirstEqual = token.indexOf('='); if (indexOfFirstEqual < 0) { furtherSplitWithEquals.add(token); } else { String left = token.substring(0, indexOfFirstEqual); String right = token.substring(indexOfFirstEqual + 1); if (left.length() > 0) { furtherSplitWithEquals.add(left); } if (right.length() > 0) { furtherSplitWithEquals.add(right); } } } if (token.equals("--query") || token.equals("--J")) { doNotRemoveEqualsInNextToken = true; } } return furtherSplitWithEquals; }

Target:
static List<String> splitUserInput(String userInput) { List<String> splitWithWhiteSpaces = splitWithWhiteSpace(userInput); List<String> furtherSplitWithEquals = new ArrayList<>(); for (String token : splitWithWhiteSpaces) { if (token.startsWith("'") || token.startsWith("\"") || token.startsWith("-D")) { furtherSplitWithEquals.add(token); continue; } int indexOfFirstEqual = token.indexOf('='); if (indexOfFirstEqual < 0) { furtherSplitWithEquals.add(token); continue; } String left = token.substring(0, indexOfFirstEqual); String right = token.substring(indexOfFirstEqual + 1); if (left.length() > 0) { furtherSplitWithEquals.add(left); } if (right.length() > 0) { furtherSplitWithEquals.add(right); } } return furtherSplitWithEquals; }
Source:
public IconvEncoder(Charset cs, float averageBytesPerChar, float maxBytesPerChar) { super(cs, averageBytesPerChar, maxBytesPerChar); this.iconv_tPointer = IconvProvider.initConversion("UTF-16LE", ((IconvCharset) cs).getIconvName()); }

Target:
public IconvEncoder(Charset cs, float averageBytesPerChar, float maxBytesPerChar) { super(cs, averageBytesPerChar, maxBytesPerChar); }
Source:
static String left(String str, int len) { if (str == null || str.isEmpty() || len == 0) { return ""; } if (len > 0) { return str.substring(0, Math.min(len, str.length())); } final int finalLen = str.length() + len; return finalLen > 0 ? str.substring(0, finalLen) : ""; }

Target:
private static String left(String str, int len) { if (len > 0) { return str.substring(0, Math.min(len, str.length())); } final int finalLen = str.length() + len; return finalLen > 0 ? str.substring(0, finalLen) : ""; }
Source:
protected Dimension constructDimension(String dimensionField, Class<?> cls, EntityDictionary entityDictionary) { Meta metaData = entityDictionary.getAttributeOrRelationAnnotation(cls, Meta.class, dimensionField); Class<?> fieldType = entityDictionary.getType(cls, dimensionField); String friendlyName = EntityDimension.getFriendlyNameField(cls, entityDictionary); CardinalitySize cardinality = EntityDimension.getEstimatedCardinality(dimensionField, cls, entityDictionary); if (entityDictionary.isRelation(cls, dimensionField)) { return new EntityDimension( dimensionField, metaData, fieldType, cardinality, friendlyName ); } else if (!getEntityDictionary().attributeOrRelationAnnotationExists(cls, dimensionField, Temporal.class)) { return new DegenerateDimension( dimensionField, metaData, fieldType, cardinality, friendlyName, DegenerateDimension.parseColumnType(dimensionField, cls, entityDictionary) ); } else { Temporal temporal = getEntityDictionary().getAttributeOrRelationAnnotation( cls, Temporal.class, dimensionField ); return new TimeDimension( dimensionField, metaData, fieldType, cardinality, friendlyName, TimeZone.getTimeZone(temporal.timeZone()), temporal.timeGrain() ); } }

Target:
protected Dimension constructDimension(String dimensionField, Class<?> cls, EntityDictionary entityDictionary) { if (getEntityDictionary().getRelationshipType(cls, dimensionField).isToMany()) { String message = String.format("ToMany relationship is not supported in '%s'", cls.getCanonicalName()); log.error(message); throw new IllegalStateException(message); } Meta metaData = entityDictionary.getAttributeOrRelationAnnotation(cls, Meta.class, dimensionField); Class<?> fieldType = entityDictionary.getType(cls, dimensionField); String friendlyName = EntityDimension.getFriendlyNameField(cls, entityDictionary); CardinalitySize cardinality = EntityDimension.getEstimatedCardinality(dimensionField, cls, entityDictionary); if (entityDictionary.isRelation(cls, dimensionField)) { return new EntityDimension( dimensionField, metaData, fieldType, cardinality, friendlyName ); } else if (!getEntityDictionary().attributeOrRelationAnnotationExists(cls, dimensionField, Temporal.class)) { return new DegenerateDimension( dimensionField, metaData, fieldType, cardinality, friendlyName, DegenerateDimension.parseColumnType(dimensionField, cls, entityDictionary) ); } else { Temporal temporal = getEntityDictionary().getAttributeOrRelationAnnotation( cls, Temporal.class, dimensionField ); return new TimeDimension( dimensionField, metaData, fieldType, cardinality, friendlyName, TimeZone.getTimeZone(temporal.timeZone()), temporal.timeGrain() ); } }
Source:
private I18n(File langFile) throws FileNotFoundException { this(new FileInputStream(langFile), langFile.getName().substring(0, langFile.getName().length() - 5)); }

Target:
private I18n(File langFile) throws FileNotFoundException { this(new FileInputStream(langFile), langFile.getName().substring(0, langFile.getName().length() - LANG_FILE_EXT.length())); }
Source:
private static String computeEntryName(Type type, int id) { if (Type.SOFT_IRQ.equals(type)) { return type.toString() + " " + SoftirqLabelProvider.getSoftIrq(id); } return type.toString() + " " + id; }

Target:
private static String computeEntryName(Type type, int id) { if (Type.SOFT_IRQ.equals(type)) { return type.toString() + ' ' + id + ' ' + SoftIrqLabelProvider.getSoftIrq(id); } return type.toString() + ' ' + id; }
Source:
private void updateActionAvailability() { List<DiskImage> disks = getSelectedItems() != null ? getSelectedItems() : new ArrayList<>(); getRemoveCommand().setIsExecutionAllowed(disks.size() > 0 && isRemoveCommandAvailable(disks)); getUploadCommand().setIsExecutionAllowed(isUploadCommandAvailable()); getCancelUploadCommand().setIsExecutionAllowed(UploadImageModel.isCancelAllowed(disks)); getPauseUploadCommand().setIsExecutionAllowed(UploadImageModel.isPauseAllowed(disks)); getResumeUploadCommand().setIsExecutionAllowed(UploadImageModel.isResumeAllowed(disks)); getDownloadCommand().setIsExecutionAllowed(DownloadImageHandler.isDownloadAllowed(disks)); updateCopyAndMoveCommandAvailability(disks); }

Target:
private void updateActionAvailability() { List<DiskImage> disks = getSelectedItems() != null ? getSelectedItems() : new ArrayList<>(); getRemoveCommand().setIsExecutionAllowed(disks.size() > 0 && isRemoveCommandAvailable(disks)); getUploadCommand().setIsExecutionAllowed(isUploadCommandAvailable()); getCancelUploadCommand().setIsExecutionAllowed(UploadImageModel.isCancelAllowed(disks)); getPauseUploadCommand().setIsExecutionAllowed(UploadImageModel.isPauseAllowed(disks)); getResumeUploadCommand().setIsExecutionAllowed(UploadImageModel.isResumeAllowed(disks)); getDownloadCommand().setIsExecutionAllowed(DownloadImageHandler.isDownloadAllowed(disks)); diskOperationsHelper.updateMoveAndCopyCommandAvailability(disks, getMoveCommand(), getCopyCommand()); }
Source:
private void updateStateOfReplicas(List<InstanceConfig> instanceConfigs) { for (InstanceConfig instanceConfig : instanceConfigs) { int schemaVersion = getSchemaVersion(instanceConfig); switch (schemaVersion) { case 0: String instanceName = instanceConfig.getInstanceName(); long instanceXid = getXid(instanceConfig); AmbryDataNode node = instanceNameToAmbryDataNode.get(instanceName); if (instanceXid <= currentXid) { if (node == null) { logger.info("Dynamic addition of new nodes is not yet supported, ignoring InstanceConfig {}", instanceConfig); } else { HashSet<String> sealedReplicas = new HashSet<>(getSealedReplicas(instanceConfig)); HashSet<String> stoppedReplicas = new HashSet<>(getStoppedReplicas(instanceConfig)); for (AmbryReplica replica : ambryDataNodeToAmbryReplicas.get(node)) { replica.setSealedState(sealedReplicas.contains(replica.getPartitionId().toPathString())); replica.setStoppedState(stoppedReplicas.contains(replica.getPartitionId().toPathString())); } } break; } else { logger.info( "Ignoring instanceConfig change for because the xid associated with it ({}) is later than current xid ({})", instanceName, instanceXid, currentXid); } default: logger.error("Unknown InstanceConfig schema version: {}, ignoring.", schemaVersion); } } }

Target:
private void updateStateOfReplicas(List<InstanceConfig> instanceConfigs) { for (InstanceConfig instanceConfig : instanceConfigs) { int schemaVersion = getSchemaVersion(instanceConfig); switch (schemaVersion) { case 0: String instanceName = instanceConfig.getInstanceName(); long instanceXid = getXid(instanceConfig); AmbryDataNode node = instanceNameToAmbryDataNode.get(instanceName); if (instanceXid <= currentXid) { if (node == null) { logger.info("Dynamic addition of new nodes is not yet supported, ignoring InstanceConfig {}", instanceConfig); } else { Set<String> sealedReplicas = new HashSet<>(getSealedReplicas(instanceConfig)); Set<String> stoppedReplicas = new HashSet<>(getStoppedReplicas(instanceConfig)); for (AmbryReplica replica : ambryDataNodeToAmbryReplicas.get(node)) { replica.setSealedState(sealedReplicas.contains(replica.getPartitionId().toPathString())); replica.setStoppedState(stoppedReplicas.contains(replica.getPartitionId().toPathString())); } } } else { logger.trace( "Ignoring instanceConfig change for because the xid associated with it ({}) is later than current xid ({})", instanceName, instanceXid, currentXid); helixClusterManagerMetrics.ignoredUpdatesCount.inc(); } break; default: logger.error("Unknown InstanceConfig schema version: {}, ignoring.", schemaVersion); } } }
Source:
private void addInterestingFiles(Map<String, List<Long>> interestingFileMap) throws IOException, TskCoreException { int lineNumber = 0; List<BlackboardArtifact> artifacts = new ArrayList<>(); Iterator<Map.Entry<String, List<Long>>> iterator = interestingFileMap.entrySet().iterator(); while (iterator.hasNext()) { if (cancelled) { break; } Map.Entry<String, List<Long>> entry = iterator.next(); String key = entry.getKey(); String ruleSetName; String ruleName; String[] split = key.split("\t"); ruleSetName = split[0]; ruleName = split[1]; List<Long> fileIds = entry.getValue(); for (Long fileId: fileIds) { if (lineNumber % REPORT_PROGRESS_INTERVAL == 0) { progressMonitor.setProgressText(Bundle.AddLogicalImageTask_addingInterestingFile(lineNumber, totalFiles)); } if (lineNumber % POST_ARTIFACT_INTERVAL == 0) { postArtifacts(artifacts); artifacts.clear(); } addInterestingFileToArtifacts(fileId, ruleSetName, ruleName, artifacts); lineNumber++; } iterator.remove(); } postArtifacts(artifacts); }

Target:
private void addInterestingFiles(Map<String, List<Long>> interestingFileMap) throws IOException, TskCoreException { int lineNumber = 0; List<BlackboardArtifact> artifacts = new ArrayList<>(); Iterator<Map.Entry<String, List<Long>>> iterator = interestingFileMap.entrySet().iterator(); while (iterator.hasNext()) { if (cancelled) { break; } Map.Entry<String, List<Long>> entry = iterator.next(); String key = entry.getKey(); String ruleSetName; String ruleName; String[] split = key.split("\t"); ruleSetName = split[0]; ruleName = split[1]; List<Long> fileIds = entry.getValue(); for (Long fileId: fileIds) { if (cancelled) { postArtifacts(artifacts); return; } if (lineNumber % REPORT_PROGRESS_INTERVAL == 0) { progressMonitor.setProgressText(Bundle.AddLogicalImageTask_addingInterestingFile(lineNumber, totalFiles)); } if (lineNumber % POST_ARTIFACT_INTERVAL == 0) { postArtifacts(artifacts); artifacts.clear(); } addInterestingFileToArtifacts(fileId, ruleSetName, ruleName, artifacts); lineNumber++; } iterator.remove(); } postArtifacts(artifacts); }
Source:
public void testFooBar() { }

Target:
public void testFooBar() throws IOException { File logfile = new File(FILE_NAME); BufferedReader bfr = null; try { bfr = new BufferedReader(new FileReader(logfile)); String line = bfr.readLine(); StringBuilder builder = new StringBuilder(); while (line != null) { builder.append(line); line = bfr.readLine(); } Assert.assertFalse("There should be no warnign produced by FieldAccessValidatorEnricher!", builder.toString().contains(PART_OF_WARNING)); } catch (Exception ex) { Assert.fail("Something gone wrong with test setup, please correct it!"); } finally { fileHandler.close(); LOGGER.removeHandler(fileHandler); logfile.delete(); bfr.close(); } }
Source:
public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + (usingScsiReservation ? 1231 : 1237); result = prime * result + ((lun == null) ? 0 : lun.hashCode()); return result; }

Target:
public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + (Boolean.TRUE.equals(usingScsiReservation) ? 1231 : 1237); result = prime * result + ((lun == null) ? 0 : lun.hashCode()); return result; }
Source:
public void pullConflictsTest() throws IOException { String javaFileChange = "JavaCommentsTest"; String textFileChange = "GitPullTest.txt"; String changeContent_2 = " projectExplorer.waitProjectExplorer(); String repoUrl = String.format("<LINK_0>", gitHubUsername, REPO_NAME); git.importJavaApp(repoUrl, PROJECT_NAME, MAVEN); changeContentOnGithubSide( String.format("%s/%s.java", pathToJavaFile, javaFileChange), CHANGE_STRING_1); changeContentOnGithubSide(textFileChange, CHANGE_STRING_1); changeJavaFileForTest(javaFileChange, changeContent_2); changeTextFileForTest(textFileChange, changeContent_2); performPull(); events.clickEventLogBtn(); events.waitExpectedMessage(firstMergeConflictMessage); commitFiles(); performPull(); events.clickEventLogBtn(); events.waitExpectedMessage(secondMergeConflictMessage); editor.selectTabByName(javaFileChange); editor.waitActive(); editor.waitTextIntoEditor(headConfPrefixConfMess); editor.selectTabByName(textFileChange); editor.waitActive(); editor.waitTextIntoEditor(headConfPrefixConfMess); }

Target:
public void pullConflictsTest() throws Exception { String javaFileChange = "AppController"; String textFileChange = "README.md"; String changeContent2 = " String pathJavaFile = String.format("%s/%s/%s.java", PROJECT_NAME, PATH_TO_JAVA_FILE, javaFileChange); String pathTextFile = String.format("%s/%s", PROJECT_NAME, textFileChange); projectExplorer.waitProjectExplorer(); String repoUrl = String.format("<LINK_0>", gitHubUsername, REPO_NAME); git.importJavaApp(repoUrl, PROJECT_NAME, MAVEN); changeContentOnGithubSide( String.format("%s/%s.java", PATH_TO_JAVA_FILE, javaFileChange), CHANGE_STRING_1); changeContentOnGithubSide(textFileChange, CHANGE_STRING_1); testProjectServiceClient.updateFile(ws.getId(), pathJavaFile, changeContent2); testProjectServiceClient.updateFile(ws.getId(), pathTextFile, changeContent2); performPull(); eventsPanel.clickEventLogBtn(); eventsPanel.waitExpectedMessage(FIRST_MERGE_CONFLICT_MESSAGE); commitFiles(); performPull(); eventsPanel.clickEventLogBtn(); eventsPanel.waitExpectedMessage(SECOND_MERGE_CONFLICT_MESSAGE); projectExplorer.quickExpandWithJavaScript(); projectExplorer.openItemByPath(pathJavaFile); editor.waitActive(); editor.waitTextIntoEditor(HEAD_CONF_PREFIX_CONF_MESS); projectExplorer.openItemByPath(pathTextFile); editor.waitActive(); editor.waitTextIntoEditor(HEAD_CONF_PREFIX_CONF_MESS); }
Source:
public int getLicenseIcon() { if (isLicensePD()) { return R.drawable.ic_license_pd; } else if (isLicenseCC()) { return R.drawable.ic_license_cc; } else { return R.drawable.ic_license_cite; } }

Target:
public int getLicenseIcon() { if (isLicensePD()) { return R.drawable.ic_license_pd; } if (isLicenseCC()) { return R.drawable.ic_license_cc; } return R.drawable.ic_license_cite; }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; EntryPoint that = (EntryPoint) o; if (pointer != null ? !pointer.equals(that.pointer) : that.pointer != null) return false; if (ownerName != null ? !ownerName.equals(that.ownerName) : that.ownerName != null) return false; if (readers != null ? !readers.equals(that.readers) : that.readers != null) return false; return writers != null ? writers.equals(that.writers) : that.writers == null; }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; EntryPoint that = (EntryPoint) o; return Objects.equals(pointer, that.pointer) && Objects.equals(ownerName, that.ownerName); }
Source:
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String key = null; String clientIdParam = request.getParameter("api_key"); String clientIdHeader = request.getHeader("API-Key"); if (clientIdHeader == clientIdParam) { key = clientIdHeader; } else { if (clientIdHeader == null) { key = clientIdParam; } else if (clientIdParam == null) { key = clientIdHeader; } else { return false; } } if (whitelist.contains(key)) { return true; } SimpleRateLimiter rateLimiter = getRateLimiter(key); boolean allowRequest = rateLimiter.tryAcquire(); if (!allowRequest) { response.sendError(HttpStatus.TOO_MANY_REQUESTS.value(), getMessage("apikey.limit", String.valueOf(limit), timeUnit)); logger.info("Client with API KEY: " + key + " went over API KEY limit of " + limit + "."); } response.addHeader("X-RateLimit-Limit", String.valueOf(limit)); return allowRequest; }

Target:
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String key = null; String clientIdParam = request.getParameter("api_key"); String clientIdHeader = request.getHeader("API-Key"); if (!StringUtils.isEmpty(clientIdParam)) { key = clientIdParam; } else if (!StringUtils.isEmpty(clientIdHeader)) { key = clientIdHeader; } else { return false; } List<ApiKeyDTO> keyDtos = apiKeyDao.findAllWhitelisted(); for (ApiKeyDTO dto : keyDtos) { whitelist.add(dto.getApiKey()); } if (whitelist.contains(key)) { return true; } SimpleRateLimiter rateLimiter = getRateLimiter(key); boolean allowRequest = rateLimiter.tryAcquire(); if (!allowRequest) { response.sendError(HttpStatus.TOO_MANY_REQUESTS.value(), errorUtil.getMessage("apikey.limit", String.valueOf(limit), timeUnit)); LOGGER.info("Client with API KEY: " + key + " went over API KEY limit of " + limit + "."); } response.addHeader("X-RateLimit-Limit", String.valueOf(limit)); return allowRequest; }