auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Status checkStatus(int status) { Status responseStatus; switch (status) { case 0: responseStatus = Status.OK; break; case 400: responseStatus = Status.BAD_REQUEST; break; case 403: responseStatus = Status.FORBIDDEN; break; case 404: responseStatus = Status.NOT_FOUND; break; case 500: responseStatus = Status.ERROR; break; case 503: responseStatus = Status.SERVICE_UNAVAILABLE; break; default: responseStatus = Status.OK; break; } return responseStatus; }

Target:
private Status checkStatus(int status) { Status responseStatus; switch (status) { case 0: responseStatus = Status.OK; break; case 400: responseStatus = Status.BAD_REQUEST; break; case 403: responseStatus = Status.FORBIDDEN; break; case 404: responseStatus = Status.NOT_FOUND; break; case 500: responseStatus = Status.ERROR; break; case 503: responseStatus = Status.SERVICE_UNAVAILABLE; break; default: responseStatus = Status.UNEXPECTED_STATE; break; } return responseStatus; }
Source:
private URI getStatsBaseUri() throws URISyntaxException { VariantSource source = getVariantSource(); return URLHelper.getStatsBaseUri( outputParameters.getOutputDirStatistics(), source.getStudyId(), source.getFileId()); }

Target:
private URI getStatsBaseUri() throws URISyntaxException { return URLHelper.getStatsBaseUri( outputParameters.getOutputDirStatistics(), inputParameters.getStudyId(), inputParameters.getVcfId()); }
Source:
public Pair split(final LayoutContext context, final int maxWidth, final boolean force) { return null; }

Target:
public Pair split(final LayoutContext context, final int maxWidth, final boolean force) { throw new UnsupportedOperationException("split method not supported"); }
Source:
protected Filter[] getAllStoredFilters(boolean defaults) { Filter[] filters = null; String[] activefilters, inactivefilters; IPreferenceStore store = getPreferenceStore(); if (defaults) { activefilters = ScriptDebugOptionsManager .parseList(store .getDefaultString(IDLTKDebugUIPreferenceConstants.PREF_ACTIVE_FILTERS_LIST)); inactivefilters = ScriptDebugOptionsManager .parseList(store .getDefaultString(IDLTKDebugUIPreferenceConstants.PREF_INACTIVE_FILTERS_LIST)); } else { activefilters = ScriptDebugOptionsManager .parseList(store .getString(IDLTKDebugUIPreferenceConstants.PREF_ACTIVE_FILTERS_LIST)); inactivefilters = ScriptDebugOptionsManager .parseList(store .getString(IDLTKDebugUIPreferenceConstants.PREF_INACTIVE_FILTERS_LIST)); } filters = new Filter[activefilters.length + inactivefilters.length]; for (int i = 0; i < activefilters.length; i++) { String[] split = activefilters[i].split(":"); if (split.length == 1) { filters[i] = new Filter(split[0], true, 0); } else { filters[i] = new Filter(split[0], true, (Integer.valueOf(split[1])) .intValue()); } } for (int i = 0; i < inactivefilters.length; i++) { String[] split = inactivefilters[i].split(":"); if (split.length == 1) { filters[i + activefilters.length] = new Filter(split[0], false, 0); } else { filters[i + activefilters.length] = new Filter(split[0], false, (Integer.valueOf(split[1])).intValue()); } } return filters; }

Target:
protected Filter[] getAllStoredFilters(boolean defaults) { Filter[] filters = null; String[] activefilters, inactivefilters; IPreferenceStore store = getPreferenceStore(); if (defaults) { activefilters = ScriptDebugOptionsManager .parseList(store.getDefaultString( IDLTKDebugUIPreferenceConstants.PREF_ACTIVE_FILTERS_LIST)); inactivefilters = ScriptDebugOptionsManager .parseList(store.getDefaultString( IDLTKDebugUIPreferenceConstants.PREF_INACTIVE_FILTERS_LIST)); } else { activefilters = ScriptDebugOptionsManager.parseList(store.getString( IDLTKDebugUIPreferenceConstants.PREF_ACTIVE_FILTERS_LIST)); inactivefilters = ScriptDebugOptionsManager .parseList(store.getString( IDLTKDebugUIPreferenceConstants.PREF_INACTIVE_FILTERS_LIST)); } filters = new Filter[activefilters.length + inactivefilters.length]; for (int i = 0; i < activefilters.length; i++) { String[] split = activefilters[i].split(":"); if (split.length == 1) { filters[i] = new Filter(split[0], true, 0); } else { filters[i] = new Filter(split[0], true, Integer.parseInt(split[1])); } } for (int i = 0; i < inactivefilters.length; i++) { String[] split = inactivefilters[i].split(":"); if (split.length == 1) { filters[i + activefilters.length] = new Filter(split[0], false, 0); } else { filters[i + activefilters.length] = new Filter(split[0], false, Integer.parseInt(split[1])); } } return filters; }
Source:
public void canBuildFromEmptyClientLimits() { assertThat(ImmutableQosServiceRuntimeConfig.builder().clientLimits(new HashMap<>()).build()) .isInstanceOf(QosServiceRuntimeConfig.class); }

Target:
public void canBuildFromEmptyClientLimits() { ImmutableQosServiceRuntimeConfig.builder().clientLimits(ImmutableMap.of()).build(); }
Source:
public void addObserver(RemoteEmfObserver<EParentObjectType, EObjectType, LocalKeyType, ObjectCurrentType> observer) { if (observer != null) { RemoteEmfObserver<EParentObjectType, EObjectType, LocalKeyType, ObjectCurrentType> remoteEmfObserver = observer; if (remoteEmfObserver.getConsumer() != null && remoteEmfObserver.getConsumer() != this) { remoteEmfObserver.getConsumer().removeObserver(remoteEmfObserver); } remoteEmfObserver.internalSetConsumer(this); } remoteEmfObservers.add(observer); }

Target:
public void addObserver(RemoteEmfObserver<EParentObjectType, EObjectType, LocalKeyType, ObjectCurrentType> observer) { if (observer != null) { RemoteEmfObserver<EParentObjectType, EObjectType, LocalKeyType, ObjectCurrentType> remoteEmfObserver = observer; if (remoteEmfObserver.getConsumer() != null && remoteEmfObserver.getConsumer() != this) { remoteEmfObserver.getConsumer().removeObserver(remoteEmfObserver); } remoteEmfObserver.internalSetConsumer(this); remoteEmfObservers.add(observer); } }
Source:
public PredicateActionResult conditionalCompute(String originator, TaskId taskid, String channel, String key, String predicate, String thenRemappingFunction, String elseRemappingFunction) throws InvalidChannelException, CompilationException, IOException { PredicateActionResult answer; try { Channel chosenChannel = getChannel(channel); Serializable value = chosenChannel.get(key); if (evaluateClosure(predicate, BiPredicate.class).test(key, value)) { answer = new PredicateActionResult(true, chosenChannel.compute(key, (BiFunction<? super String, ? super Serializable, ? extends Serializable>) evaluateClosure(thenRemappingFunction, BiFunction.class))); } else { answer = new PredicateActionResult(false, chosenChannel.compute(key, (BiFunction<? super String, ? super Serializable, ? extends Serializable>) evaluateClosure(elseRemappingFunction, BiFunction.class))); } commitIfNeeded(channel); logWithContext(taskid, channel, "Run conditionalCompute" + ON_KEY + QUOTE + key + QUOTE + RESULT_IS + answer, Level.DEBUG); } catch (InvalidChannelException | CompilationException | IOException e) { throw e; } catch (Exception e) { throw new ClosureEvaluationException(EXCEPTION_WHEN_EVALUATING_CLOSURE + StackTraceUtil.getStackTrace(e)); } return answer; }

Target:
public PredicateActionResult conditionalCompute(String originator, TaskId taskid, String channel, String key, String predicate, String thenRemappingFunction, String elseRemappingFunction) throws InvalidChannelException, CompilationException, IOException { PredicateActionResult answer; try { Channel chosenChannel = getChannel(channel); Serializable value = chosenChannel.get(key); if (evaluateClosure(predicate, BiPredicate.class).test(key, value)) { answer = new PredicateActionResult(true, chosenChannel.compute(key, (BiFunction<? super String, ? super Serializable, ? extends Serializable>) evaluateClosure(thenRemappingFunction, BiFunction.class))); } else { answer = new PredicateActionResult(false, chosenChannel.compute(key, (BiFunction<? super String, ? super Serializable, ? extends Serializable>) evaluateClosure(elseRemappingFunction, BiFunction.class))); } logWithContextAndPersist(taskid, channel, "Run conditionalCompute" + ON_KEY + QUOTE + key + QUOTE + RESULT_IS + answer, Level.DEBUG); } catch (InvalidChannelException | CompilationException | IOException e) { throw e; } catch (Exception e) { throw new ClosureEvaluationException(EXCEPTION_WHEN_EVALUATING_CLOSURE + StackTraceUtil.getStackTrace(e)); } return answer; }
Source:
public void userCapsNodeChanged(String user, ArrayList<String> fullJids, String node, boolean online) { OperationSetPresence opsetPresence = parentProvider.getOperationSet(OperationSetPresence.class); if (opsetPresence != null) { if(LibJitsi.getConfigurationService() .getBoolean( XMPPConfigForm.PROP_XMPP_USE_ALL_RESOURCES_FOR_CAPABILITIES, XMPPConfigForm.USE_ALL_RESOURCES_FOR_CAPABILITIES_DEFAULT)) { String bareJid = StringUtils.parseBareAddress(user); Contact contact = opsetPresence.findContactByID(bareJid); if (contact != null) { fireContactCapabilitiesEvent( contact, ContactCapabilitiesEvent.SUPPORTED_OPERATION_SETS_CHANGED, getLargestSupportedOperationSet(fullJids)); } } else { String jid = StringUtils.parseBareAddress(user); Contact contact = opsetPresence.findContactByID(jid); if (contact != null) { if(online) { fireContactCapabilitiesEvent( contact, ContactCapabilitiesEvent.SUPPORTED_OPERATION_SETS_CHANGED, getSupportedOperationSets(user, online)); } else { fireContactCapabilitiesEvent( contact, ContactCapabilitiesEvent.SUPPORTED_OPERATION_SETS_CHANGED, getSupportedOperationSets(contact)); } } } } }

Target:
public void userCapsNodeChanged(String user, ArrayList<String> fullJids, String node, boolean online) { OperationSetPresence opsetPresence = parentProvider.getOperationSet(OperationSetPresence.class); if (opsetPresence != null) { if(JabberActivator.getConfigurationService() .getBoolean( PROP_XMPP_USE_ALL_RESOURCES_FOR_CAPABILITIES, USE_ALL_RESOURCES_FOR_CAPABILITIES_DEFAULT)) { String bareJid = StringUtils.parseBareAddress(user); Contact contact = opsetPresence.findContactByID(bareJid); if (contact != null) { fireContactCapabilitiesEvent( contact, ContactCapabilitiesEvent. SUPPORTED_OPERATION_SETS_CHANGED, getLargestSupportedOperationSet(fullJids)); } } else { String jid = StringUtils.parseBareAddress(user); Contact contact = opsetPresence.findContactByID(jid); if (contact != null) { if(online) { fireContactCapabilitiesEvent( contact, ContactCapabilitiesEvent. SUPPORTED_OPERATION_SETS_CHANGED, getSupportedOperationSets(user, online)); } else { fireContactCapabilitiesEvent( contact, ContactCapabilitiesEvent. SUPPORTED_OPERATION_SETS_CHANGED, getSupportedOperationSets(contact)); } } } } }
Source:
public void setUp() throws Exception { database = SQLiteDatabase.create(null); database.execSQL("CREATE TABLE table_name(" + "id INTEGER PRIMARY KEY, " + "name VARCHAR(255), " + "long_value BIGINT," + "float_value REAL," + "double_value DOUBLE, " + "blob_value BINARY, " + "clob_value CLOB );"); addPeople(); setupCursor(); }

Target:
public void setUp() throws Exception { database = SQLiteDatabase.create(null); database.execSQL("CREATE TABLE table_name(" + "id INTEGER PRIMARY KEY, " + "name VARCHAR(255), " + "long_value BIGINT," + "float_value REAL," + "double_value DOUBLE, " + "blob_value BINARY, " + "clob_value CLOB );"); addPeople(); cursor = createCursor(); }
Source:
public DashboardSettings(DashboardSettings other) { this.newItemsRegistry = new LinkedList<ItemRegistry>(other.newItemsRegistry); }

Target:
public DashboardSettings(DashboardSettings other) { this.newItemsRegistry = (other.newItemsRegistry != null) ? new LinkedList<ItemRegistry>(other.newItemsRegistry) : null; }
Source:
public void should_expose_warnings_on_execution_info() { final String query = String.format( "BEGIN UNLOGGED BATCH\n" + "INSERT INTO test (k, v) VALUES (1, '%s')\n" + "INSERT INTO test (k, v) VALUES (2, '%s')\n" + "APPLY BATCH", Strings.repeat("1", 2 * 1024), Strings.repeat("1", 3 * 1024)); Statement<?> st = SimpleStatement.builder(String.format(query)).build(); ResultSet result = SESSION_RULE.session().execute(st); ExecutionInfo executionInfo = result.getExecutionInfo(); assertThat(executionInfo).isNotNull(); List<String> warnings = executionInfo.getWarnings(); assertThat(warnings).isNotNull(); assertThat(warnings).isNotEmpty(); Mockito.verify(appender, after(500).times(1)).doAppend(loggingEventCaptor.capture()); assertThat(loggingEventCaptor.getValue().getMessage()).isNotNull(); String logMessage = loggingEventCaptor.getValue().getFormattedMessage(); assertThat(logMessage) .startsWith("Query '") .contains( query.substring( 0, SESSION_RULE .session() .getContext() .getConfig() .getDefaultProfile() .getInt(DefaultDriverOption.REQUEST_LOGGER_MAX_QUERY_LENGTH))) .contains("' generated server side warning(s): ") .contains( String.format( "Batch for [%s.test] is of size 5152, exceeding specified threshold of 5120 by 32.", SESSION_RULE.keyspace().asCql(true))); }

Target:
public void should_expose_warnings_on_execution_info() { final String query = String.format( "BEGIN UNLOGGED BATCH\n" + "INSERT INTO test (k, v) VALUES (1, '%s')\n" + "INSERT INTO test (k, v) VALUES (2, '%s')\n" + "APPLY BATCH", Strings.repeat("1", 2 * 1024), Strings.repeat("1", 3 * 1024)); Statement<?> st = SimpleStatement.builder(String.format(query)).build(); ResultSet result = SESSION_RULE.session().execute(st); ExecutionInfo executionInfo = result.getExecutionInfo(); assertThat(executionInfo).isNotNull(); List<String> warnings = executionInfo.getWarnings(); assertThat(warnings).isNotEmpty(); verify(appender, after(500).times(1)).doAppend(loggingEventCaptor.capture()); assertThat(loggingEventCaptor.getValue().getMessage()).isNotNull(); String logMessage = loggingEventCaptor.getValue().getFormattedMessage(); assertThat(logMessage) .startsWith("Query '") .contains(query.substring(0, RequestLogger.DEFAULT_REQUEST_LOGGER_MAX_QUERY_LENGTH)) .contains("' generated server side warning(s): ") .contains( String.format( "Batch for [%s.test] is of size 5152, exceeding specified threshold of 5120 by 32.", SESSION_RULE.keyspace().asCql(true))); }
Source:
private static EntityGraph<?> tryGetFetchGraph(EntityManager em, JpaEntityGraph jpaEntityGraph, Class<?> entityType) { Assert.notNull(em, "EntityManager must not be null!"); Assert.notNull(jpaEntityGraph, "EntityGraph must not be null!"); Assert.notNull(entityType, "EntityType must not be null!"); Assert.isTrue(JPA21_AVAILABLE, "The EntityGraph-Feature requires at least a JPA 2.1 persistence provider!"); Assert.isTrue(GET_ENTITY_GRAPH_METHOD != null, "It seems that you have the JPA 2.1 API but a JPA 2.0 implementation on the classpath!"); try { return em.getEntityGraph(jpaEntityGraph.getName()); } catch (Exception ex) { return PersistenceProvider.fromEntityManager(em).createDynamicEntityGraph(em, jpaEntityGraph, entityType); } }

Target:
private static EntityGraph<?> tryGetFetchGraph(EntityManager em, JpaEntityGraph jpaEntityGraph, Class<?> entityType) { Assert.notNull(em, "EntityManager must not be null!"); Assert.notNull(jpaEntityGraph, "EntityGraph must not be null!"); Assert.notNull(entityType, "EntityType must not be null!"); Assert.isTrue(JPA21_AVAILABLE, "The EntityGraph-Feature requires at least a JPA 2.1 persistence provider!"); Assert.isTrue(GET_ENTITY_GRAPH_METHOD != null, "It seems that you have the JPA 2.1 API but a JPA 2.0 implementation on the classpath!"); if (!jpaEntityGraph.isDynamicEntityGraph()) { return em.getEntityGraph(jpaEntityGraph.getName()); } return createDynamicEntityGraph(em, jpaEntityGraph, entityType); }
Source:
public JaversBuilder scanTypeNames(String packagesToScan){ if(packagesToScan==null || packagesToScan.trim().isEmpty()) return this; Class<?>[] list = ReflectionUtil.getClasses(TypeName.class, packagesToScan.split(",")); for (Class<?> c : list) { scanTypeName(c); } return this; }

Target:
public JaversBuilder scanTypeNames(String packagesToScan){ if(packagesToScan==null || packagesToScan.trim().isEmpty()) { return this; } List<Class<?>> list = ReflectionUtil.getClasses(TypeName.class, packagesToScan.split(",")); for (Class<?> c : list) { scanTypeName(c); } return this; }
Source:
private Map<CodeSystemEntry, IVersioningManager> createVersioningManagers(final ServiceProvider context, Map<String, CodeSystemEntry> codeSystemsByShortName, final CodeSystemEntry baseCodeSystem) { final Map<CodeSystemEntry, IVersioningManager> versioningManagersByCodeSystem = Maps.newHashMap(); final IVersioningManager versioningManager = VersioningManagerBroker.INSTANCE.createVersioningManager(baseCodeSystem.getTerminologyComponentId()); versioningManagersByCodeSystem.put(baseCodeSystem, versioningManager); CoreTerminologyBroker.getInstance().getAffectedCodeSystemsForTeminology(baseCodeSystem.getTerminologyComponentId()) .stream() .map(affectedCodeSystemShortName -> codeSystemsByShortName.get(affectedCodeSystemShortName)) .forEach(affectedCodeSystem -> { final IVersioningManager affectedVersioningManager = VersioningManagerBroker.INSTANCE.createVersioningManager(affectedCodeSystem.getTerminologyComponentId()); versioningManagersByCodeSystem.put(affectedCodeSystem, affectedVersioningManager); }); return versioningManagersByCodeSystem; }

Target:
private Map<CodeSystemEntry, IVersioningManager> createVersioningManagers(final ServiceProvider context, Map<String, CodeSystemEntry> codeSystemsByShortName, final CodeSystemEntry baseCodeSystem) { final Map<CodeSystemEntry, IVersioningManager> versioningManagersByCodeSystem = Maps.newHashMap(); baseCodeSystem.getDependenciesAndSelf() .stream() .map(affectedCodeSystemShortName -> codeSystemsByShortName.get(affectedCodeSystemShortName)) .forEach(affectedCodeSystem -> { final IVersioningManager affectedVersioningManager = VersioningManagerBroker.INSTANCE.createVersioningManager(affectedCodeSystem.getTerminologyComponentId()); versioningManagersByCodeSystem.put(affectedCodeSystem, affectedVersioningManager); }); return versioningManagersByCodeSystem; }
Source:
public void testSuiteStarted(Description description) { String uid = this.generateSuiteUid(description.getDisplayName()); String suiteName = System.getProperty("fitnesseSuiteToRun"); if(null == suiteName) { suiteName = description.getAnnotation(FitNesseRunner.Suite.class).value(); } TestSuiteStartedEvent event = new TestSuiteStartedEvent(uid, suiteName); AnnotationManager am = new AnnotationManager(description.getAnnotations()); am.update(event); event.withLabels(AllureModelUtils.createTestFrameworkLabel("JUnit")); this.getLifecycle().fire(event); }

Target:
private void testSuiteStarted(Description description) { String uid = this.generateSuiteUid(description.getDisplayName()); String suiteName = System.getProperty("fitnesseSuiteToRun"); if(null == suiteName) { suiteName = description.getAnnotation(FitNesseRunner.Suite.class).value(); } TestSuiteStartedEvent event = new TestSuiteStartedEvent(uid, suiteName); AnnotationManager am = new AnnotationManager(description.getAnnotations()); am.update(event); event.withLabels(AllureModelUtils.createTestFrameworkLabel("FitNesse")); this.getLifecycle().fire(event); }
Source:
private static void writeTargetFactorNormalizeReadCountsAndTargetFactors(final File outFile, final ReadCountCollection readCounts, final double[] targetFactors, final List<Target> rawTargets) { final List<String> sampleNames = readCounts.columnNames(); final List<String> targetNames = readCounts.targets().stream() .map(Target::getName) .collect(Collectors.toList()); try (final HDF5File file = new HDF5File(outFile, HDF5File.OpenMode.CREATE)) { final HDF5PoN pon = new HDF5PoN(file); logger.info("Creating " + outFile.getAbsolutePath() + "..."); logger.info("Setting sample names ..."); pon.setSampleNames(sampleNames); logger.info("Setting target names ..."); pon.setTargetNames(targetNames); logger.info("Setting target factors (" + targetFactors.length + ") ..."); pon.setTargetFactors(new Array2DRowRealMatrix(targetFactors)); logger.info("Setting normal counts (" + readCounts.counts().getRowDimension() + " x " + readCounts.counts().getColumnDimension() + ") (T)..."); pon.setNormalCounts(readCounts.counts()); logger.info("Setting targets ..."); pon.setTargets(readCounts.targets()); logger.info("Setting raw targets ..."); pon.setRawTargets(rawTargets); logger.info("Setting raw target names ..."); pon.setRawTargetNames(rawTargets.stream().map(Target::getName).collect(Collectors.toList())); } }

Target:
private static void writeTargetFactorNormalizeReadCountsAndTargetFactors(final File outFile, final ReadCountCollection readCounts, final double[] targetFactors, final List<Target> rawTargets) { final List<String> sampleNames = readCounts.columnNames(); final List<String> targetNames = readCounts.targets().stream() .map(Target::getName) .collect(Collectors.toList()); try (final HDF5File file = new HDF5File(outFile, HDF5File.OpenMode.CREATE)) { final HDF5PoN pon = new HDF5PoN(file); logger.info("Creating " + outFile.getAbsolutePath() + "..."); logger.info("Setting sample names ..."); pon.setSampleNames(sampleNames); logger.info("Setting target names ..."); pon.setTargetNames(targetNames); logger.info("Setting target factors (" + targetFactors.length + ") ..."); pon.setTargetFactors(new Array2DRowRealMatrix(targetFactors)); logger.info("Setting coverage profile (" + readCounts.counts().getRowDimension() + " x " + readCounts.counts().getColumnDimension() + ") (T)..."); pon.setNormalCounts(readCounts.counts()); logger.info("Setting targets ..."); pon.setTargets(readCounts.targets()); logger.info("Setting raw targets ..."); pon.setRawTargets(rawTargets); logger.info("Setting raw target names ..."); pon.setRawTargetNames(rawTargets.stream().map(Target::getName).collect(Collectors.toList())); } }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/toneMapping"); sceneToneMapped = dynamicFBM.getFBO(TONE_MAPPED_URN); sceneOpaque = dynamicFBM.getFBO(DefaultDynamicFBOs.ReadOnlyGBuffer.getResourceUrn()); toneMapping.enable(); sceneToneMapped.bind(); setViewportToSizeOf(sceneToneMapped); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); bindDisplay(); setViewportToSizeOf(sceneOpaque); PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/toneMapping"); sceneToneMapped = displayResolutionDependentFBOs.get(TONE_MAPPED); toneMapping.enable(); sceneToneMapped.bind(); setViewportToSizeOf(sceneToneMapped); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); bindDisplay(); setViewportToSizeOf(READ_ONLY_GBUFFER); PerformanceMonitor.endActivity(); }
Source:
public ArrayInterface setDate(int index, Date value) { return setObject(index, value); }

Target:
public Array setDate(int index, Date value) { return setObject(index, value); }
Source:
public void addDocument(BytesReference document, String index, String indexType, int ttlMs) throws Exception { Map<String, Map<String, String>> parameters = new HashMap<String, Map<String, String>>(); Map<String, String> indexParameters = new HashMap<String, String>(); indexParameters.put(INDEX_PARAM, index); indexParameters.put(TYPE_PARAM, indexType); if (ttlMs > 0) { indexParameters.put(TTL_PARAM, Long.toString(ttlMs)); } parameters.put(INDEX_OPERATION_NAME, indexParameters); XContentBuilder documentBuilder = jsonBuilder().value(parameters); synchronized (bulkBuilder) { bulkBuilder.append(documentBuilder.bytes().toUtf8()); bulkBuilder.append("\n"); bulkBuilder.append(document.toBytesArray().toUtf8()); bulkBuilder.append("\n"); } }

Target:
public void addDocument(BytesReference document, String index, String indexType, int ttlMs) throws Exception { Map<String, Map<String, String>> parameters = new HashMap<String, Map<String, String>>(); Map<String, String> indexParameters = new HashMap<String, String>(); indexParameters.put(INDEX_PARAM, index); indexParameters.put(TYPE_PARAM, indexType); if (ttlMs > 0) { indexParameters.put(TTL_PARAM, Long.toString(ttlMs)); } parameters.put(INDEX_OPERATION_NAME, indexParameters); bulkBuilder.append(jsonBuilder().value(parameters).bytes().toUtf8()); bulkBuilder.append("\n"); bulkBuilder.append(document.toBytesArray().toUtf8()); bulkBuilder.append("\n"); }
Source:
public void bind(final EditorSession session) { super.bind(session); if(stateControlInitializer.isKogitoEnabled()) { stateControlInitializer.setUndoCommand(this::execute); } else { session.getKeyboardControl().addKeyShortcutCallback(this::onKeyDownEvent); } }

Target:
public void bind(final EditorSession session) { super.bind(session); bindCommand(); }
Source:
public boolean canAmend() { return true; }

Target:
public boolean canAmend() { return false; }
Source:
void getGames() { cache.put(ID_0, lobbyGame0); cache.put(new GameId(API_KEY_0, GAME_ID_1), lobbyGame1); cache.put(new GameId(API_KEY_1, GAME_ID_2), lobbyGame2); final List<LobbyGameListing> result = gameListing.getGames(); assertThat((long) result.size(), is(cache.size())); assertThat( result, IsCollectionContaining.hasItem( LobbyGameListing.builder().gameId(GAME_ID_0).lobbyGame(lobbyGame0).build())); assertThat( result, IsCollectionContaining.hasItem( LobbyGameListing.builder().gameId(GAME_ID_1).lobbyGame(lobbyGame1).build())); assertThat( result, IsCollectionContaining.hasItem( LobbyGameListing.builder().gameId(GAME_ID_2).lobbyGame(lobbyGame2).build())); }

Target:
void getGames() { cache.put(ID_0, lobbyGame0); cache.put(new GameId(API_KEY_0, GAME_ID_1), lobbyGame1); cache.put(new GameId(API_KEY_1, GAME_ID_2), lobbyGame2); final List<LobbyGameListing> result = gameListing.getGames(); assertThat(result.size(), is((int) cache.size())); assertThat( result, IsCollectionContaining.hasItem( LobbyGameListing.builder().gameId(GAME_ID_0).lobbyGame(lobbyGame0).build())); assertThat( result, IsCollectionContaining.hasItem( LobbyGameListing.builder().gameId(GAME_ID_1).lobbyGame(lobbyGame1).build())); assertThat( result, IsCollectionContaining.hasItem( LobbyGameListing.builder().gameId(GAME_ID_2).lobbyGame(lobbyGame2).build())); }
Source:
public Mono<Long> scheduleMessage(ServiceBusMessage message, Instant scheduledEnqueueTime) { Objects.requireNonNull(message, "'message' cannot be null."); Objects.requireNonNull(scheduledEnqueueTime, "'scheduledEnqueueTime' cannot be null."); return connectionProcessor .flatMap(connection -> connection.getManagementNode(entityName)) .flatMap(x -> x.schedule(message, scheduledEnqueueTime)) .flatMap(scheduleSequenceNumber -> { System.out.println(getClass().getName() + ".schedule scheduleSequenceNumber = " + scheduleSequenceNumber); return Mono.just(scheduleSequenceNumber); }); }

Target:
public Mono<Long> scheduleMessage(ServiceBusMessage message, Instant scheduledEnqueueTime) { Objects.requireNonNull(message, "'message' cannot be null."); Objects.requireNonNull(scheduledEnqueueTime, "'scheduledEnqueueTime' cannot be null."); return getSendLink() .flatMap(link -> link.getLinkSize().flatMap(size -> { int maxSize = size > 0 ? size : MAX_MESSAGE_LENGTH_BYTES; return connectionProcessor .flatMap(connection -> connection.getManagementNode(entityName, entityType)) .flatMap(managementNode -> managementNode.schedule(message, scheduledEnqueueTime, maxSize)); })); }
Source:
private BasicDBObject createItemInsertQuery(final String userId, final String itemId, final School.ItemType itemType) { final BasicDBObject query = new BasicDBObject(DatabaseStringConstants.SELF_ID, new ObjectId(itemId)); if (School.ItemType.COURSE.equals(itemType)) { query.append(DatabaseStringConstants.COURSE_ID, new ObjectId(itemId)) .append(DatabaseStringConstants.OWNER_ID, userId); } if (School.ItemType.BANK_PROBLEM.equals(itemType)) { query.append(DatabaseStringConstants.PROBLEM_BANK_ID, itemId) .append(DatabaseStringConstants.OWNER_ID, userId); } return query; }

Target:
private BasicDBObject createItemInsertQuery(final String userId, final String itemId, final School.ItemType itemType) { final BasicDBObject query = new BasicDBObject(DatabaseStringConstants.SELF_ID, new ObjectId(itemId)); if (School.ItemType.COURSE.equals(itemType)) { query.append(DatabaseStringConstants.COURSE_ID, new ObjectId(itemId)) .append(DatabaseStringConstants.OWNER_ID, userId); } else if (School.ItemType.BANK_PROBLEM.equals(itemType)) { query.append(DatabaseStringConstants.PROBLEM_BANK_ID, new ObjectId(itemId)) .append(DatabaseStringConstants.OWNER_ID, userId); } return query; }
Source:
public void run() { try { if (this.zooCache == null) { Instance instance = HdfsZooInstance.getInstance(); this.path = ZooUtil.getRoot(instance) + Constants.ZMONITOR_LOG4J_ADDR; this.zooCache = new ZooCacheFactory().getZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut()); } Stat stat = new Stat(); byte[] loc = zooCache.get(path, stat); long modifiedTransactionId = stat.getMzxid(); if (modifiedTransactionId != lastModifiedTransactionId) { switchAppender(loc, modifiedTransactionId); } } catch (Exception e) { e.printStackTrace(); } }

Target:
public void run() { try { MonitorLocation currentLocation = currentLocationSupplier.get(); if (!currentLocation.equals(lastLocation)) { if (lastSocketAppender != null) { parentAsyncAppender.removeAppender(lastSocketAppender); lastSocketAppender.close(); lastSocketAppender = null; } if (currentLocation.hasLocation()) { lastSocketAppender = appenderFactory.apply(currentLocation); lastSocketAppender.activateOptions(); parentAsyncAppender.addAppender(lastSocketAppender); } lastLocation = currentLocation; } } catch (Exception e) { e.printStackTrace(); } }
Source:
private int traverse(Deque<Chunk> traversedChunksDeque) { Chunk currentChunk; activeChunkLock.lock(); try { currentChunk = activeChunk; } finally { activeChunkLock.unlock(); } int valuesSize = 0; while (true) { valuesSize += currentChunk.cursor - currentChunk.startIndex; if (traversedChunksDeque != null) { traversedChunksDeque.addLast(currentChunk); } if (currentChunk.tailChunk == null) { break; } currentChunk = currentChunk.tailChunk; } return valuesSize; }

Target:
private int traverse(Deque<Chunk> traversedChunksDeque) { Chunk currentChunk = activeChunk; int valuesSize = 0; while (true) { valuesSize += currentChunk.cursor - currentChunk.startIndex; if (traversedChunksDeque != null) { traversedChunksDeque.addLast(currentChunk); } if (currentChunk.tailChunk == null) { break; } currentChunk = currentChunk.tailChunk; } return valuesSize; }
Source:
public ServiceCall<UtterancesTone> getChatTone(ToneChatInput chatInput) { Validator.notNull(chatInput, "text cannot be null"); RequestBuilder requestBuilder = RequestBuilder.post(PATH_CHAT_TONE).query(VERSION_DATE, versionDate); requestBuilder.bodyJson(GsonSingleton.getGson().toJsonTree(chatInput).getAsJsonObject()); return createServiceCall(requestBuilder.build(), ResponseConverterUtils.getObject(UtterancesTone.class)); }

Target:
public ServiceCall<UtterancesTone> getChatTone(ToneChatInput chatInput) { Validator.notNull(chatInput.getUtterances(), "Input utterances cannot be null"); RequestBuilder requestBuilder = RequestBuilder.post(PATH_CHAT_TONE).query(VERSION_DATE, versionDate); requestBuilder.bodyJson(GsonSingleton.getGson().toJsonTree(chatInput).getAsJsonObject()); return createServiceCall(requestBuilder.build(), ResponseConverterUtils.getObject(UtterancesTone.class)); }
Source:
private String verhoeffChecksum(String input) { int[][] op = new int[][]{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {1, 2, 3, 4, 0, 6, 7, 8, 9, 5}, {2, 3, 4, 0, 1, 7, 8, 9, 5, 6}, {3, 4, 0, 1, 2, 8, 9, 5, 6, 7}, {4, 0, 1, 2, 3, 9, 5, 6, 7, 8}, {5, 9, 8, 7, 6, 0, 4, 3, 2, 1}, {6, 5, 9, 8, 7, 1, 0, 4, 3, 2}, {7, 6, 5, 9, 8, 2, 1, 0, 4, 3}, {8, 7, 6, 5, 9, 3, 2, 1, 0, 4}, {9, 8, 7, 6, 5, 4, 3, 2, 1, 0} }; int[][] p = new int[][]{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {1, 5, 7, 6, 2, 8, 3, 0, 9, 4}, {5, 8, 0, 3, 7, 9, 6, 1, 4, 2}, {8, 9, 1, 6, 0, 4, 3, 5, 2, 7}, {9, 4, 5, 3, 1, 2, 6, 8, 7, 0}, {4, 2, 8, 6, 5, 7, 3, 9, 0, 1}, {2, 7, 9, 3, 8, 0, 6, 4, 1, 5}, {7, 0, 4, 6, 9, 1, 3, 2, 5, 8} }; int[] inv = {0, 4, 3, 2, 1, 5, 6, 7, 8, 9}; int check = 0; String[] mArray = ArrayUtilities.reverse(StringUtils.toArray(input), String[].class); for (int i = 0; i < mArray.length; i++) { check = op[check][p[((i + 1) % 8)][Integer.parseInt(mArray[i])]]; } return Integer.toString(inv[check]); }

Target:
private static String verhoeffChecksum(String input) { int[][] op = new int[][]{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {1, 2, 3, 4, 0, 6, 7, 8, 9, 5}, {2, 3, 4, 0, 1, 7, 8, 9, 5, 6}, {3, 4, 0, 1, 2, 8, 9, 5, 6, 7}, {4, 0, 1, 2, 3, 9, 5, 6, 7, 8}, {5, 9, 8, 7, 6, 0, 4, 3, 2, 1}, {6, 5, 9, 8, 7, 1, 0, 4, 3, 2}, {7, 6, 5, 9, 8, 2, 1, 0, 4, 3}, {8, 7, 6, 5, 9, 3, 2, 1, 0, 4}, {9, 8, 7, 6, 5, 4, 3, 2, 1, 0} }; int[][] p = new int[][]{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {1, 5, 7, 6, 2, 8, 3, 0, 9, 4}, {5, 8, 0, 3, 7, 9, 6, 1, 4, 2}, {8, 9, 1, 6, 0, 4, 3, 5, 2, 7}, {9, 4, 5, 3, 1, 2, 6, 8, 7, 0}, {4, 2, 8, 6, 5, 7, 3, 9, 0, 1}, {2, 7, 9, 3, 8, 0, 6, 4, 1, 5}, {7, 0, 4, 6, 9, 1, 3, 2, 5, 8} }; int[] inv = {0, 4, 3, 2, 1, 5, 6, 7, 8, 9}; ArrayList<Character> inputList = StringUtils.toList(input); Collections.reverse(inputList); int check = 0; for (int i = 0; i < inputList.size(); i++) { check = op[check][p[((i + 1) % 8)][Character.getNumericValue(inputList.get(i))]]; } return Integer.toString(inv[check]); }
Source:
public List<Constituent> getConstituentsOverlappingCharSpan(int charStart, int charEnd) { Set<Constituent> output = new HashSet<>(); for(Constituent c : this.constituents) { if((c.startCharOffset <= charStart && c.endCharOffset >= charStart) || (c.startCharOffset >= charEnd && c.endCharOffset <= charEnd) || (c.startCharOffset >= charStart && c.endCharOffset <= charEnd) || (c.startCharOffset <= charStart && c.endCharOffset >= charEnd)) output.add(c); } List<Constituent> list = new ArrayList<>(output); Collections.sort(list, TextAnnotationUtilities.constituentStartComparator); return list; }

Target:
public List<Constituent> getConstituentsOverlappingCharSpan(int charStart, int charEnd) { assert charStart <= charEnd: "The start offset should be smaller than the end offset"; Set<Constituent> output = new HashSet<>(); for(Constituent c : this.constituents) { if((c.startCharOffset <= charStart && c.endCharOffset >= charStart) || (c.startCharOffset <= charEnd && c.endCharOffset >= charEnd) || (c.startCharOffset >= charStart && c.endCharOffset <= charEnd) || (c.startCharOffset <= charStart && c.endCharOffset >= charEnd)) output.add(c); } List<Constituent> list = new ArrayList<>(output); Collections.sort(list, TextAnnotationUtilities.constituentStartComparator); return list; }
Source:
private void whole(final long pos, final int type, final long sz) throws IOException { objectDigest.update(Constants.encodedTypeString(type)); objectDigest.update((byte) ' '); objectDigest.update(Constants.encodeASCII(sz)); objectDigest.update((byte) 0); final byte[] data; boolean checkContentLater = false; if (type == Constants.OBJ_BLOB) { byte[] readBuffer = buffer(); InputStream inf = inflate(Source.INPUT, sz); long cnt = 0; while (cnt < sz) { int r = inf.read(readBuffer); if (r <= 0) break; objectDigest.update(readBuffer, 0, r); cnt += r; } inf.close(); tempObjectId.fromRaw(objectDigest.digest(), 0); checkContentLater = isCheckObjectCollisions() && readCurs.has(tempObjectId); data = null; } else { data = inflateAndReturn(Source.INPUT, sz); objectDigest.update(data); tempObjectId.fromRaw(objectDigest.digest(), 0); } verifySafeObject(tempObjectId, type, data, sz); PackedObjectInfo obj = newInfo(tempObjectId, null, null); obj.setOffset(pos); onEndWholeObject(obj); if (data != null) onInflatedObjectData(obj, type, data); addObjectAndTrack(obj); if (checkContentLater) deferredCheckBlobs.add(obj); }

Target:
private void whole(final long pos, final int type, final long sz) throws IOException { checkIfTooLarge(sz); objectDigest.update(Constants.encodedTypeString(type)); objectDigest.update((byte) ' '); objectDigest.update(Constants.encodeASCII(sz)); objectDigest.update((byte) 0); final byte[] data; boolean checkContentLater = false; if (type == Constants.OBJ_BLOB) { byte[] readBuffer = buffer(); InputStream inf = inflate(Source.INPUT, sz); long cnt = 0; while (cnt < sz) { int r = inf.read(readBuffer); if (r <= 0) break; objectDigest.update(readBuffer, 0, r); cnt += r; } inf.close(); tempObjectId.fromRaw(objectDigest.digest(), 0); checkContentLater = isCheckObjectCollisions() && readCurs.has(tempObjectId); data = null; } else { data = inflateAndReturn(Source.INPUT, sz); objectDigest.update(data); tempObjectId.fromRaw(objectDigest.digest(), 0); verifySafeObject(tempObjectId, type, data); } PackedObjectInfo obj = newInfo(tempObjectId, null, null); obj.setOffset(pos); onEndWholeObject(obj); if (data != null) onInflatedObjectData(obj, type, data); addObjectAndTrack(obj); if (checkContentLater) deferredCheckBlobs.add(obj); }
Source:
public void init(ZeppelinConfiguration zConf) throws IOException { this.fs = new FileSystemStorage(zConf, zConf.getString(ZeppelinConfiguration.ConfVars.ZEPPELIN_RECOVERY_DIR)); LOGGER.info("Creating FileSystem: " + this.fs.getFs().getClass().getName() + " for Zeppelin Notebook."); this.notebookDir = this.fs.makeQualified(new Path(zConf.getNotebookDir())); LOGGER.info("Using folder to store notebook", notebookDir); this.fs.tryMkDir(notebookDir); }

Target:
public void init(ZeppelinConfiguration zConf) throws IOException { this.fs = new FileSystemStorage(zConf, zConf.getString(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_DIR)); LOGGER.info("Creating FileSystem: " + this.fs.getFs().getClass().getName() + " for Zeppelin Notebook."); this.notebookDir = this.fs.makeQualified(new Path(zConf.getNotebookDir())); LOGGER.info("Using folder to store notebook", notebookDir); this.fs.tryMkDir(notebookDir); }
Source:
public NotifyingFuture<Void> putAllAsync(final Map<? extends K, ? extends V> data, final long lifespan, final TimeUnit lifespanUnit, final long maxIdle, final TimeUnit maxIdleUnit) { assertRemoteCacheManagerIsStarted(); final NotifyingFutureImpl<Void> result = new NotifyingFutureImpl<Void>(); Future<Void> future = executorService.submit(new Callable<Void>() { @Override public Void call() throws Exception { try { final ArrayList<NotifyingFuture<V>> putList = new ArrayList<NotifyingFuture<V>>(); for (java.util.Map.Entry<? extends K, ? extends V> x : data.entrySet()) { putList.add(putAsync(x.getKey(), x.getValue(), lifespan, lifespanUnit, maxIdle, maxIdleUnit)); } for (NotifyingFuture<V> f : putList) { while (!f.isDone()) { try { Thread.sleep(1); } catch (InterruptedException x) { } } } try { result.notifyDone(null); } catch (Throwable t) { log.trace("Error when notifying", t); } return null; } catch (Exception e) { try { result.notifyException(e); } catch (Throwable t) { log.trace("Error when notifying", t); } throw e; } } }); result.setFuture(future); return result; }

Target:
public NotifyingFuture<Void> putAllAsync(final Map<? extends K, ? extends V> data, final long lifespan, final TimeUnit lifespanUnit, final long maxIdle, final TimeUnit maxIdleUnit) { assertRemoteCacheManagerIsStarted(); final NotifyingFutureImpl<Void> result = new NotifyingFutureImpl<Void>(); Future<Void> future = executorService.submit(new Callable<Void>() { @Override public Void call() throws Exception { try { final ArrayList<NotifyingFuture<V>> putList = new ArrayList<NotifyingFuture<V>>(data.size()); for (java.util.Map.Entry<? extends K, ? extends V> x : data.entrySet()) { putList.add(putAsync(x.getKey(), x.getValue(), lifespan, lifespanUnit, maxIdle, maxIdleUnit)); } for (NotifyingFuture<V> f : putList) { f.get(); } try { result.notifyDone(null); } catch (Throwable t) { log.trace("Error when notifying", t); } return null; } catch (Exception e) { try { result.notifyException(e); } catch (Throwable t) { log.trace("Error when notifying", t); } throw e; } } }); result.setFuture(future); return result; }
Source:
public List<Map<String, Object>> query(String url, Query query) { try { StatusResponseHolder response = httpClient.go( new Request(HttpMethod.POST, new URL(url)).setContent( "application/json", jsonMapper.writeValueAsBytes(query) ), responseHandler ).get(); if (!response.getStatus().equals(HttpResponseStatus.OK)) { throw new ISE( "Error while querying[%s] status[%s] content[%s]", getBrokerURL(), response.getStatus(), response.getContent() ); } return jsonMapper.readValue( response.getContent(), new TypeReference<List<Map<String, Object>>>() { } ); } catch (Exception e) { log.error("exception: " + e.getMessage()); throw Throwables.propagate(e); } }

Target:
public List<Map<String, Object>> query(String url, Query query) { try { StatusResponseHolder response = httpClient.go( new Request(HttpMethod.POST, new URL(url)).setContent( "application/json", jsonMapper.writeValueAsBytes(query) ), responseHandler ).get(); if (!response.getStatus().equals(HttpResponseStatus.OK)) { throw new ISE( "Error while querying[%s] status[%s] content[%s]", getBrokerURL(), response.getStatus(), response.getContent() ); } return jsonMapper.readValue( response.getContent(), new TypeReference<List<Map<String, Object>>>() { } ); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
public void testValidateStorageAccount() throws Exception { System.out.println("validateStorageAccount"); StorageAccountInfo storageAccount = testEnv.sampleStorageAccount; boolean expResult = true; boolean result = WAStorageClient.validateStorageAccount(storageAccount); assertEquals(expResult, result); }

Target:
public void testValidateStorageAccount() throws Exception { System.out.println("validateStorageAccount"); StorageAccountInfo storageAccount = testEnv.sampleStorageAccount; boolean result = WAStorageClient.validateStorageAccount(storageAccount); assertEquals(true, result); assertEquals(true,WAStorageClient.validateStorageAccount(new StorageAccountInfo(testEnv.azureStorageAccountName, testEnv.azureStorageAccountKey1, ""))); testEnv.container.deleteIfExists(); }
Source:
public long scanJournal(long journalId, long journalPos, JournalScanner scanner) throws IOException { JournalChannel recLog; if (journalPos <= 0) { recLog = new JournalChannel(journalDirectory, journalId, journalPreAllocSize, journalWriteBufferSize); } else { recLog = new JournalChannel(journalDirectory, journalId, journalPreAllocSize, journalWriteBufferSize, journalPos); } int journalVersion = recLog.getFormatVersion(); try { ByteBuffer lenBuff = ByteBuffer.allocate(4); ByteBuffer recBuff = ByteBuffer.allocate(64 * 1024); while (true) { long offset = recLog.fc.position(); lenBuff.clear(); fullRead(recLog, lenBuff); if (lenBuff.remaining() != 0) { break; } lenBuff.flip(); int len = lenBuff.getInt(); if (len == 0) { break; } boolean isPaddingRecord = false; if (len < 0) { if (len == PADDING_MASK && journalVersion >= JournalChannel.V5) { lenBuff.clear(); fullRead(recLog, lenBuff); if (lenBuff.remaining() != 0) { break; } lenBuff.flip(); len = lenBuff.getInt(); if (len == 0) { continue; } isPaddingRecord = true; } else { LOG.error("Invalid record found with negative length: {}", len); throw new IOException(); } } recBuff.clear(); if (recBuff.remaining() < len) { recBuff = ByteBuffer.allocate(len); } recBuff.limit(len); if (fullRead(recLog, recBuff) != len) { break; } recBuff.flip(); if (!isPaddingRecord) { scanner.process(journalVersion, offset, recBuff); } } return recLog.fc.position(); } finally { recLog.close(); } }

Target:
public long scanJournal(long journalId, long journalPos, JournalScanner scanner) throws IOException { JournalChannel recLog; if (journalPos <= 0) { recLog = new JournalChannel(journalDirectory, journalId, journalPreAllocSize, journalWriteBufferSize); } else { recLog = new JournalChannel(journalDirectory, journalId, journalPreAllocSize, journalWriteBufferSize, journalPos); } int journalVersion = recLog.getFormatVersion(); try { ByteBuffer lenBuff = ByteBuffer.allocate(4); ByteBuffer recBuff = ByteBuffer.allocate(64 * 1024); while (true) { long offset = recLog.fc.position(); lenBuff.clear(); fullRead(recLog, lenBuff); if (lenBuff.remaining() != 0) { break; } lenBuff.flip(); int len = lenBuff.getInt(); if (len == 0) { break; } boolean isPaddingRecord = false; if (len < 0) { if (len == PADDING_MASK && journalVersion >= JournalChannel.V5) { lenBuff.clear(); fullRead(recLog, lenBuff); if (lenBuff.remaining() != 0) { break; } lenBuff.flip(); len = lenBuff.getInt(); if (len == 0) { continue; } isPaddingRecord = true; } else { LOG.error("Invalid record found with negative length: {}", len); throw new IOException("Invalid record found with negative length " + len); } } recBuff.clear(); if (recBuff.remaining() < len) { recBuff = ByteBuffer.allocate(len); } recBuff.limit(len); if (fullRead(recLog, recBuff) != len) { break; } recBuff.flip(); if (!isPaddingRecord) { scanner.process(journalVersion, offset, recBuff); } } return recLog.fc.position(); } finally { recLog.close(); } }
Source:
public void setDockerImageRepository(DockerImageURI uri) { set(DOCKER_IMAGE_REPO, uri.getAbsoluteUri()); }

Target:
public void setDockerImageRepository(DockerImageURI uri) { setDockerImageRepository(uri.getAbsoluteUri()); }
Source:
private LanguageRegistry() { List<Language> languagesList = new ArrayList<>(); ServiceLoader<Language> languageLoader = ServiceLoader.load(Language.class); for (Language aLanguageLoader : languageLoader) { try { languagesList.add(aLanguageLoader); } catch (UnsupportedClassVersionError e) { System.err.println("Ignoring language for PMD: " + e.toString()); } } Collections.sort(languagesList, new Comparator<Language>() { @Override public int compare(Language o1, Language o2) { return o1.getTerseName().compareToIgnoreCase(o2.getTerseName()); } }); languages = new LinkedHashMap<>(); for (Language language : languagesList) { languages.put(language.getName(), language); } }

Target:
private LanguageRegistry() { List<Language> languagesList = new ArrayList<>(); ServiceLoader<Language> languageLoader = ServiceLoader.load(Language.class); Iterator<Language> iterator = languageLoader.iterator(); while (iterator.hasNext()) { try { Language language = iterator.next(); languagesList.add(language); } catch (UnsupportedClassVersionError e) { System.err.println("Ignoring language for PMD: " + e.toString()); } } Collections.sort(languagesList, new Comparator<Language>() { @Override public int compare(Language o1, Language o2) { return o1.getTerseName().compareToIgnoreCase(o2.getTerseName()); } }); languages = new LinkedHashMap<>(); for (Language language : languagesList) { languages.put(language.getName(), language); } }
Source:
private void readEnergy() throws InvalidSensorException { byte[] rawArray = statusEnergy.read(); if (rawArray != null) { cachedCurrent = (((rawArray[1] & 0xFF) << 4) | ((rawArray[2] & 0xF0) >> 4)) * 0.125; cachedPower = (((rawArray[1] & 0x0F) << 12) | (rawArray[2] << 4) | ((rawArray[4] & 0xF0) >> 4)) * 0.125; cachedEnergy = (((rawArray[4] & 0x0F) << 24) | (rawArray[5] << 16) | (rawArray[6] << 8) | (rawArray[7])) * 0.000125 * rawArray[0]; lastRead = System.currentTimeMillis(); } else if (System.currentTimeMillis() - lastRead > PDP.MAX_AGE) { throw new InvalidSensorException("Can not read voltage from PDP"); } }

Target:
private void readEnergy() throws InvalidSensorException { byte[] rawArray = statusEnergy.read(); if (rawArray != null) { cachedCurrent = (((rawArray[1] & 0xFF) << 4) | ((rawArray[2] & 0xF0) >> 4)) * 0.125; cachedPower = (((rawArray[1] & 0x0F) << 12) | (rawArray[2] << 4) | ((rawArray[4] & 0xF0) >> 4)) * 0.125; cachedEnergy = (((rawArray[4] & 0x0F) << 24) | (rawArray[5] << 16) | (rawArray[6] << 8) | (rawArray[7])) * 0.000125 * rawArray[0]; lastRead = System.currentTimeMillis(); } else if (System.currentTimeMillis() - lastRead > PDP.MAX_AGE) { throw new InvalidSensorException("Can not read energy from PDP"); } }
Source:
public Result applySuffix(List<Term> terms, MetaData metaData) { Term newTerm = terms.get(0).shallowCopy(); newTerm.setLocation("("+metaData.startLine+","+metaData.startColumn+","+metaData.endLine+","+metaData.endColumn+")"); return new Accept(Arrays.asList(newTerm)); }

Target:
public List<Term> applySuffix(List<Term> terms, MetaData metaData) { Term newTerm = terms.get(0).shallowCopy(); newTerm.setLocation("("+metaData.start.line+","+metaData.start.column+","+metaData.end.line+","+metaData.end.column+")"); return Arrays.asList(newTerm); }