auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected StatEntry trainEpoch() { resetNetworks(); InitMdp<Observation> initMdp = refacInitMdp(); Observation obs = initMdp.getLastObs(); double reward = initMdp.getReward(); Double startQ = Double.NaN; double meanQ = 0; int numQ = 0; List<Double> scores = new ArrayList<>(); while (currentEpochStep < getConfiguration().getMaxEpochStep() && !getMdp().isDone()) { if (getStepCounter() % getConfiguration().getTargetDqnUpdateFreq() == 0) { updateTargetNetwork(); } QLStepReturn<Observation> stepR = trainStep(obs); if (!stepR.getMaxQ().isNaN()) { if (startQ.isNaN()) startQ = stepR.getMaxQ(); numQ++; meanQ += stepR.getMaxQ(); } if (stepR.getScore() != 0) scores.add(stepR.getScore()); reward += stepR.getStepReply().getReward(); obs = stepR.getStepReply().getObservation(); incrementStep(); } meanQ /= (numQ + 0.001); StatEntry statEntry = new QLStatEntry(getStepCounter(), getCurrentEpochStep(), reward, currentEpochStep, scores, getEgPolicy().getEpsilon(), startQ, meanQ); return statEntry; }

Target:
protected StatEntry trainEpoch() { resetNetworks(); InitMdp<Observation> initMdp = refacInitMdp(); Observation obs = initMdp.getLastObs(); double reward = initMdp.getReward(); Double startQ = Double.NaN; double meanQ = 0; int numQ = 0; List<Double> scores = new ArrayList<>(); while (currentEpochStep < getConfiguration().getMaxEpochStep() && !getMdp().isDone()) { if (getStepCounter() % getConfiguration().getTargetDqnUpdateFreq() == 0) { updateTargetNetwork(); } QLStepReturn<Observation> stepR = trainStep(obs); if (!stepR.getMaxQ().isNaN()) { if (startQ.isNaN()) startQ = stepR.getMaxQ(); numQ++; meanQ += stepR.getMaxQ(); } if (stepR.getScore() != 0) scores.add(stepR.getScore()); reward += stepR.getStepReply().getReward(); obs = stepR.getStepReply().getObservation(); incrementStep(); } finishEpoch(obs); meanQ /= (numQ + 0.001); StatEntry statEntry = new QLStatEntry(getStepCounter(), getEpochCounter(), reward, currentEpochStep, scores, getEgPolicy().getEpsilon(), startQ, meanQ); return statEntry; }
Source:
public void stop() throws CopycatException { log.info("Stopping table monitoring thread"); tableMonitorThread.shutdown(); try { tableMonitorThread.join(10000); } catch (InterruptedException e) { } log.debug("Trying to close database connection"); try { db.close(); } catch (SQLException e) { log.error("Failed to close database connection: ", e); } }

Target:
public void stop() throws CopycatException { log.info("Stopping table monitoring thread"); tableMonitorThread.shutdown(); try { tableMonitorThread.join(MAX_TIMEOUT); } catch (InterruptedException e) { } log.debug("Trying to close database connection"); try { db.close(); } catch (SQLException e) { log.error("Failed to close database connection: ", e); } }
Source:
public void apply(MouseEvent event) { ChangeTaskProgressRuler.Progress progress = myChangeScale.getProgress(event.getX()); int newProgress = progress.toPercents(); if (newProgress > 100) { newProgress = 100; } if (newProgress < 0) { newProgress = 0; } myMutator.setCompletionPercentage(newProgress); String hintText = newProgress + "% (" + progress.toUnits() + getChartDateGrid().getTimeUnitStack().encode(getTask().getDuration().getTimeUnit()) + ")"; myLastNotes = new TaskInteractionHintRenderer(hintText, event.getX(), event.getY() - 30); }

Target:
public void apply(MouseEvent event) { ChangeTaskProgressRuler.Progress progress = myChangeScale.getProgress(event.getX()); int newProgress = progress.toPercents(); if (newProgress > 100) { newProgress = 100; } if (newProgress < 0) { newProgress = 0; } myMutator.setCompletionPercentage(newProgress); String hintText = getHintText(newProgress, progress.toUnits()); myLastNotes = new TaskInteractionHintRenderer(hintText, event.getX(), event.getY() - 30); }
Source:
public JsonFieldTransformer(String json) { List<Field> l = new ArrayList<>(); try { JSONArray jarr = new JSONArray(json); if (jarr.size() > 0) { JSONObject jo = jarr.getJSONObject(0); if (jo.has("fields")) { l = fromJsonArray(jo.getJSONArray("fields")); } else { l = fromJsonArrayStr(json); } } } catch (Exception e) { try { JSONObject jo = new JSONObject(json); if (jo.has("fields")) { l = fromJsonArray(jo.getJSONArray("fields")); } else { l.add(fromJsonStr(json)); } } catch (Exception ex) { throw new DotStateException(ex); } } this.list = ImmutableList.copyOf(l); }

Target:
public JsonFieldTransformer(String json) { List<Field> l = new ArrayList<>(); try { JSONArray jarr = new JSONArray(json); if (jarr.size() > 0) { JSONObject jo = jarr.getJSONObject(0); if (jo.has("fields")) { l = fromJsonArray(jo.getJSONArray("fields")); } else { l = fromJsonArrayStr(json); } } } catch (Exception e) { try { final JSONObject fieldJsonObject = new JSONObject(json); if (fieldJsonObject.has("fields")) { l = fromJsonArray(fieldJsonObject.getJSONArray("fields")); } else { l.add(fromJsonStr(json)); } } catch (Exception ex) { throw new DotStateException(ex); } } this.list = ImmutableList.copyOf(l); }
Source:
public ProgramEnrollment getFirstObject() { return results.get(0); }

Target:
public ProgramEnrollment getFirstObject() { if (results.size() > 0) { return results.get(0); } else { return null; } }
Source:
public FEELFnResult<Boolean> invoke(@ParameterName( "list" ) List list) { if ( list == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "list", "cannot be null")); } boolean result = false; for ( final Object element : list ) { if (element != null && !(element instanceof Boolean)) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "an element in the list is not a Boolean")); } else { result |= element != null && element == Boolean.TRUE; } } return FEELFnResult.ofResult( result ); }

Target:
public FEELFnResult<Boolean> invoke(@ParameterName( "list" ) List list) { if ( list == null ) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "list", "cannot be null")); } boolean result = false; boolean containsNull = false; for ( final Object element : list ) { if (element != null && !(element instanceof Boolean)) { return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "an element in the list is not a Boolean")); } else { if (element != null) { result |= (Boolean) element; } else if (!containsNull) { containsNull = true; } } } if (containsNull && !result) { return FEELFnResult.ofResult( null ); } else { return FEELFnResult.ofResult( result ); } }
Source:
public void testSingleSplit() throws IOException, InterruptedException { FileSplit fileSplit = new FileSplit( new Path("file", "", testAvroFile.getAbsolutePath()), 0, testAvroFile.length(), new String[0]); AvroRecordReader recordReader = new AvroRecordReader(); recordReader.initializeInternal(fileSplit, new Configuration()); Truth.assertThat(remainingRecordCount(recordReader)).isEqualTo(RECORD_COUNT); recordReader.close(); }

Target:
public void testSingleSplit() throws IOException, InterruptedException { FileSplit fileSplit = new FileSplit( new Path("file", null, testAvroFile.getAbsolutePath()), 0, testAvroFile.length(), new String[0]); AvroRecordReader recordReader = new AvroRecordReader(); recordReader.initializeInternal(fileSplit, new Configuration()); Truth.assertThat(remainingRecordCount(recordReader)).isEqualTo(RECORD_COUNT); recordReader.close(); }
Source:
public void evaluate_constantSubject() throws Exception { final MongoClient client = MockMongoSingleton.getInstance(); final EntityStorage storage = new MongoEntityStorage(client, "testDB"); final ValueFactory vf = ValueFactoryImpl.getInstance(); final RyaURI subject = new RyaURI("urn:SSN:111-11-1111"); final Entity entity = Entity.builder() .setSubject(subject) .setExplicitType(PERSON_TYPE.getId()) .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:age"), RdfToRyaConversions.convertLiteral(vf.createLiteral(20)))) .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:eye"), RdfToRyaConversions.convertLiteral(vf.createLiteral("blue")))) .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:name"), RdfToRyaConversions.convertLiteral(vf.createLiteral("Bob")))) .build(); storage.create(entity); final List<StatementPattern> patterns = getSPs( "SELECT * WHERE { " + "<urn:SSN:111-11-1111> <" + RDF.TYPE + "> <urn:person> ."+ "<urn:SSN:111-11-1111> <urn:age> ?age . " + "<urn:SSN:111-11-1111> <urn:eye> ?eye . " + "<urn:SSN:111-11-1111> <urn:name> ?name . " + "}"); final EntityQueryNode node = new EntityQueryNode(PERSON_TYPE, patterns, storage); final CloseableIteration<BindingSet, QueryEvaluationException> rez = node.evaluate(new MapBindingSet()); final MapBindingSet expected = new MapBindingSet(); expected.addBinding("age", vf.createLiteral("20")); expected.addBinding("eye", vf.createLiteral("blue")); expected.addBinding("name", vf.createLiteral("Bob")); while(rez.hasNext()) { assertEquals(expected, rez.next()); break; } }

Target:
public void evaluate_constantSubject() throws Exception { final EntityStorage storage = new MongoEntityStorage(super.getMongoClient(), "testDB"); final ValueFactory vf = ValueFactoryImpl.getInstance(); final RyaURI subject = new RyaURI("urn:SSN:111-11-1111"); final Entity entity = Entity.builder() .setSubject(subject) .setExplicitType(PERSON_TYPE.getId()) .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:age"), RdfToRyaConversions.convertLiteral(vf.createLiteral(20)))) .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:eye"), RdfToRyaConversions.convertLiteral(vf.createLiteral("blue")))) .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:name"), RdfToRyaConversions.convertLiteral(vf.createLiteral("Bob")))) .build(); storage.create(entity); final List<StatementPattern> patterns = getSPs( "SELECT * WHERE { " + "<urn:SSN:111-11-1111> <" + RDF.TYPE + "> <urn:person> ."+ "<urn:SSN:111-11-1111> <urn:age> ?age . " + "<urn:SSN:111-11-1111> <urn:eye> ?eye . " + "<urn:SSN:111-11-1111> <urn:name> ?name . " + "}"); final EntityQueryNode node = new EntityQueryNode(PERSON_TYPE, patterns, storage); final CloseableIteration<BindingSet, QueryEvaluationException> rez = node.evaluate(new MapBindingSet()); final MapBindingSet expected = new MapBindingSet(); expected.addBinding("age", vf.createLiteral("20")); expected.addBinding("eye", vf.createLiteral("blue")); expected.addBinding("name", vf.createLiteral("Bob")); while(rez.hasNext()) { assertEquals(expected, rez.next()); break; } }
Source:
public Object execute(final ExecutionEvent event) throws ExecutionException { final List<RefNode> nodes = getSelectedNodes(event); final List<RefNode> unmergedNodes = new ArrayList<RefNode>(); final Shell shell = getShell(event); try { new ProgressMonitorDialog(shell).run(false, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { monitor.beginTask(UIText.DeleteBranchCommand_DeletingBranchesProgress, nodes.size()); for (RefNode refNode : nodes) { int result = deleteBranch(refNode, refNode .getObject(), false); if (result == DeleteBranchOperation.REJECTED_CURRENT) { throw new CoreException( Activator .createErrorStatus( UIText.DeleteBranchCommand_CannotDeleteCheckedOutBranch, null)); } else if (result == DeleteBranchOperation.REJECTED_UNMERGED) { unmergedNodes.add(refNode); } else monitor.worked(1); } if (!unmergedNodes.isEmpty()) { @SuppressWarnings("unchecked") MessageDialog messageDialog = new UnmergedBranchDialog( shell, unmergedNodes); if (messageDialog.open() == Window.OK) { for (RefNode node : unmergedNodes) { deleteBranch(node, node.getObject(), true); monitor.worked(1); } } } } catch (CoreException ex) { throw new InvocationTargetException(ex); } finally { monitor.done(); } } }); } catch (InvocationTargetException e1) { Activator.handleError( UIText.RepositoriesView_BranchDeletionFailureMessage, e1 .getCause(), true); } catch (InterruptedException e1) { } return null; }

Target:
public Object execute(final ExecutionEvent event) throws ExecutionException { final List<RefNode> nodes = getSelectedNodes(event); final List<RefNode> unmergedNodes = new ArrayList<RefNode>(); final Shell shell = getShell(event); try { new ProgressMonitorDialog(shell).run(false, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { monitor.beginTask(UIText.DeleteBranchCommand_DeletingBranchesProgress, nodes.size()); for (RefNode refNode : nodes) { int result = deleteBranch(refNode, refNode .getObject(), false); if (result == DeleteBranchOperation.REJECTED_CURRENT) { throw new CoreException( Activator .createErrorStatus( UIText.DeleteBranchCommand_CannotDeleteCheckedOutBranch, null)); } else if (result == DeleteBranchOperation.REJECTED_UNMERGED) { unmergedNodes.add(refNode); } else monitor.worked(1); } if (!unmergedNodes.isEmpty()) { MessageDialog messageDialog = new UnmergedBranchDialog<RefNode>( shell, unmergedNodes); if (messageDialog.open() == Window.OK) { for (RefNode node : unmergedNodes) { deleteBranch(node, node.getObject(), true); monitor.worked(1); } } } } catch (CoreException ex) { throw new InvocationTargetException(ex); } finally { monitor.done(); } } }); } catch (InvocationTargetException e1) { Activator.handleError( UIText.RepositoriesView_BranchDeletionFailureMessage, e1 .getCause(), true); } catch (InterruptedException e1) { } return null; }
Source:
public void mergesDedicatedRows() { accumulator.accumulateBatch(SweepBatch.of( ImmutableList.of(), DEDICATED_ROWS_1, PROGRESS_TIMESTAMP + 177)); accumulator.accumulateBatch(SweepBatch.of( ImmutableList.of(), DEDICATED_ROWS_2, PROGRESS_TIMESTAMP + 288)); SweepBatchWithPartitionInfo batchWithPartitionInfo = accumulator.toSweepBatch(); assertThat(batchWithPartitionInfo.sweepBatch()).satisfies(batch -> { assertThat(batch.dedicatedRows()).isEqualTo(DedicatedRows.of( ImmutableList.of(SWEEPABLE_CELLS_ROW_1, SWEEPABLE_CELLS_ROW_2))); assertThat(batch.lastSweptTimestamp()).isEqualTo(PROGRESS_TIMESTAMP + 288); }); assertThat(batchWithPartitionInfo.finePartitions()).isEqualTo(ImmutableSet.of()); }

Target:
public void mergesDedicatedRows() { accumulator.accumulateBatch(SweepBatch.of( ImmutableList.of(), DEDICATED_ROWS_1, PROGRESS_TIMESTAMP + 177)); accumulator.accumulateBatch(SweepBatch.of( ImmutableList.of(), DEDICATED_ROWS_2, PROGRESS_TIMESTAMP + 288)); SweepBatchWithPartitionInfo batchWithPartitionInfo = accumulator.toSweepBatch(); assertThat(batchWithPartitionInfo.sweepBatch()).satisfies(batch -> { assertThat(batch.dedicatedRows()).isEqualTo(DedicatedRows.of( ImmutableList.of(SWEEPABLE_CELLS_ROW_1, SWEEPABLE_CELLS_ROW_2))); assertThat(batch.lastSweptTimestamp()).isEqualTo(PROGRESS_TIMESTAMP + 288); }); assertThat(batchWithPartitionInfo.finePartitions()).isEqualTo(ImmutableSet.of( SweepQueueUtils.tsPartitionFine(PROGRESS_TIMESTAMP + 177), SweepQueueUtils.tsPartitionFine(PROGRESS_TIMESTAMP + 288))); }
Source:
public void createTable(ConnectorTableMetadata tableMetadata) { try { createTable(tableMetadata, tableMetadata.getTable().getTableName()); } catch (SQLException e) { if (DUPLICATE_TABLE_SQLSTATE.equals(e.getSQLState())) { throw new PrestoException(ALREADY_EXISTS, e); } else { throw new PrestoException(JDBC_ERROR, e); } } }

Target:
public void createTable(ConnectorTableMetadata tableMetadata) { try { createTable(tableMetadata, tableMetadata.getTable().getTableName()); } catch (SQLException e) { if (DUPLICATE_TABLE_SQLSTATE.equals(e.getSQLState())) { throw new PrestoException(ALREADY_EXISTS, e); } throw new PrestoException(JDBC_ERROR, e); } }
Source:
public void onServerStopped() throws IOException { SpongeImpl.postState(GameState.SERVER_STOPPED, SpongeEventFactory.createGameStoppedServerEvent(Sponge.getCauseStackManager().getCurrentCause())); if (this.game.getServiceProvider().sqlService() instanceof SqlServiceImpl) { ((SqlServiceImpl) this.game.getServiceProvider().sqlService()).close(); } SpongeImpl.getConfigSaveManager().flush(); }

Target:
public void onServerStopped() throws IOException { SpongeCommon.postState(GameState.SERVER_STOPPED, SpongeEventFactory.createGameStoppedServerEvent(Sponge.getCauseStackManager().getCurrentCause())); ((SpongeSqlManager) this.game.getServiceProvider().sqlService()).close(); SpongeImpl.getConfigSaveManager().flush(); }
Source:
public Response deactivate(Action action) { HotPlugDiskToVmParameters params = new HotPlugDiskToVmParameters(((BackendDisksResource) collection).parentId, Guid.createGuidFromString(id)); return performAction(VdcActionType.HotUnPlugDiskFromVm, params); }

Target:
public Response deactivate(Action action) { HotPlugDiskToVmParameters params = new HotPlugDiskToVmParameters(((BackendDisksResource) collection).parentId, guid); return performAction(VdcActionType.HotUnPlugDiskFromVm, params); }
Source:
protected void doExecute(Runnable task) { if (shutdownStarted.get()) { throw new RejectedExecutionException("Pool is shutdown"); } long seed = Math.abs(task.hashCode() ^ Clock.lastKnownTimeNanos()); Worker w1 = schedulers[(int)(seed % schedulers.length)]; if (w1.taskQueue.isEmpty()) { w1.addTask(task); } else { Worker w2 = schedulers[(int)((seed + 1) % schedulers.length)]; if (w1.taskQueue.size() < w2.taskQueue.size()) { w1.addTask(task); } else { w2.addTask(task); } } }

Target:
protected void doExecute(Runnable task) { if (shutdownStarted.get()) { throw new RejectedExecutionException("Pool is shutdown"); } schedulers[(int)(Math.abs(stripeGenerator.getStripe(task)) % schedulers.length)].addTask(task); }
Source:
private static void findAndCopySQLiteMetaFile(AbstractFile sqliteFile, String metaFileName) throws NoCurrentCaseException, TskCoreException, IOException { if(sqliteFile.getParentPath().contains("carvedfiles")) { return; } Case openCase = Case.getCurrentCaseThrows(); SleuthkitCase sleuthkitCase = openCase.getSleuthkitCase(); Services services = new Services(sleuthkitCase); FileManager fileManager = services.getFileManager(); List<AbstractFile> metaFiles = fileManager.findFilesExactName(sqliteFile.getParent().getId(), metaFileName); if (metaFiles != null) { for (AbstractFile metaFile : metaFiles) { String localDiskPath = openCase.getTempDirectory() + File.separator + sqliteFile.getId() + metaFile.getName(); File localMetaFile = new File(localDiskPath); if (!localMetaFile.exists()) { ContentUtils.writeToFile(metaFile, localMetaFile); } } } }

Target:
private static void findAndCopySQLiteMetaFile(AbstractFile sqliteFile, String metaFileName) throws NoCurrentCaseException, TskCoreException, IOException { if(sqliteFile.getParentPath().equalsIgnoreCase("/$carvedfiles/")) { return; } Case openCase = Case.getCurrentCaseThrows(); SleuthkitCase sleuthkitCase = openCase.getSleuthkitCase(); Services services = new Services(sleuthkitCase); FileManager fileManager = services.getFileManager(); List<AbstractFile> metaFiles = fileManager.findFilesExactName(sqliteFile.getParent().getId(), metaFileName); if (metaFiles != null) { for (AbstractFile metaFile : metaFiles) { String localDiskPath = openCase.getTempDirectory() + File.separator + sqliteFile.getId() + metaFile.getName(); File localMetaFile = new File(localDiskPath); if (!localMetaFile.exists()) { ContentUtils.writeToFile(metaFile, localMetaFile); } } } }
Source:
private DruidCoordinatorRuntimeParams setupParamsForMaintenancePriority(int priority) { mockDruidServer(druidServer1, "1", "normal", 30L, 100L, ImmutableMap.of(segment1.getIdentifier(), segment1, segment3.getIdentifier(), segment3)); mockDruidServer(druidServer2, "2", "normal", 30L, 100L, ImmutableMap.of(segment2.getIdentifier(), segment2, segment3.getIdentifier(), segment3)); mockDruidServer(druidServer3, "3", "normal", 0L, 100L, Collections.emptyMap()); EasyMock.replay(druidServer4); mockCoordinator(coordinator); BalancerStrategy strategy = EasyMock.createMock(BalancerStrategy.class); EasyMock.expect(strategy.pickSegmentToMove(ImmutableList.of(new ServerHolder(druidServer2, peon2, true)))) .andReturn(new BalancerSegmentHolder(druidServer2, segment2)); EasyMock.expect(strategy.pickSegmentToMove(anyObject())) .andReturn(new BalancerSegmentHolder(druidServer1, segment1)); EasyMock.expect(strategy.findNewSegmentHomeBalancer(anyObject(), anyObject())).andReturn(new ServerHolder(druidServer3, peon3)).anyTimes(); replay(strategy); return defaultRuntimeParamsBuilder( ImmutableList.of(druidServer1, druidServer2, druidServer3), ImmutableList.of(peon1, peon2, peon3), ImmutableList.of(false, true, false) ) .withDynamicConfigs( CoordinatorDynamicConfig.builder() .withMaxSegmentsToMove( 1 ).withMaintenanceModeSegmentsPriority(priority).build() ) .withBalancerStrategy(strategy) .build(); }

Target:
private DruidCoordinatorRuntimeParams setupParamsForMaintenancePriority(int priority) { mockDruidServer(druidServer1, "1", "normal", 30L, 100L, Arrays.asList(segment1, segment3)); mockDruidServer(druidServer2, "2", "normal", 30L, 100L, Arrays.asList(segment2, segment3)); mockDruidServer(druidServer3, "3", "normal", 0L, 100L, Collections.emptyList()); EasyMock.replay(druidServer4); mockCoordinator(coordinator); BalancerStrategy strategy = EasyMock.createMock(BalancerStrategy.class); EasyMock.expect(strategy.pickSegmentToMove(ImmutableList.of(new ServerHolder(druidServer2, peon2, true)))) .andReturn(new BalancerSegmentHolder(druidServer2, segment2)); EasyMock.expect(strategy.pickSegmentToMove(anyObject())) .andReturn(new BalancerSegmentHolder(druidServer1, segment1)); EasyMock.expect(strategy.findNewSegmentHomeBalancer(anyObject(), anyObject())) .andReturn(new ServerHolder(druidServer3, peon3)) .anyTimes(); replay(strategy); return defaultRuntimeParamsBuilder( ImmutableList.of(druidServer1, druidServer2, druidServer3), ImmutableList.of(peon1, peon2, peon3), ImmutableList.of(false, true, false) ) .withDynamicConfigs( CoordinatorDynamicConfig.builder() .withMaxSegmentsToMove(1) .withMaintenanceModeSegmentsPriority(priority) .build() ) .withBalancerStrategy(strategy) .build(); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || !getClass().equals(o.getClass())) { return false; } final ImmutableDruidDataSource that = (ImmutableDruidDataSource) o; if (!this.name.equals(that.name)) { return false; } if (!this.properties.equals(that.properties)) { return false; } if (!this.idToSegments.equals(that.idToSegments)) { return false; } return this.segmentsHolder.equals(that.segmentsHolder); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || !getClass().equals(o.getClass())) { return false; } final ImmutableDruidDataSource that = (ImmutableDruidDataSource) o; if (!this.name.equals(that.name)) { return false; } if (!this.properties.equals(that.properties)) { return false; } return this.idToSegments.equals(that.idToSegments); }
Source:
public static boolean validatePort(int port) { return ((port >= 1) && (port <= 65535)); }

Target:
public static boolean validatePort(int port) { return ((port >= BusinessEntitiesDefinitions.NETWORK_MIN_LEGAL_PORT) && (port <= BusinessEntitiesDefinitions.NETWORK_MAX_LEGAL_PORT)); }
Source:
public LookupStrategy getPackageLookupStrategy(String packageName) { LookupStrategy lookupStrategy = lookupStrategies.get().get(packageName); if (lookupStrategy == null) { if (isSystemPackage(packageName)) { lookupStrategy = PARENT_ONLY; } else { lookupStrategy = CHILD_FIRST; } lookupStrategies.get().put(packageName, lookupStrategy); } return lookupStrategy; }

Target:
public LookupStrategy getPackageLookupStrategy(String packageName) { LookupStrategy lookupStrategy = lookupStrategies.get(packageName); if (lookupStrategy == null) { synchronized (this) { lookupStrategy = lookupStrategies.get(packageName); if (lookupStrategy == null) { if (isSystemPackage(packageName)) { lookupStrategy = PARENT_ONLY; } else { lookupStrategy = CHILD_FIRST; } lookupStrategies.put(packageName, lookupStrategy); } } } return lookupStrategy; }
Source:
public void updateWorkerAnnouncement(Worker newWorker) throws Exception { synchronized (lock) { if (!started) { log.error("Cannot update worker! Not Started!"); return; } announcer.update(getAnnouncementsPathForWorker(), jsonMapper.writeValueAsBytes(newWorker)); } }

Target:
public void updateWorkerAnnouncement(Worker newWorker) throws Exception { synchronized (lock) { if (!started) { throw new ISE("Cannot update worker! Not Started!"); } this.worker = newWorker; announcer.update(getAnnouncementsPathForWorker(), jsonMapper.writeValueAsBytes(newWorker)); } }
Source:
public void testFileAsStringNamedPipe() throws Exception { Random random = new Random(); long n = random.nextLong(); n = n == Long.MIN_VALUE ? 0 : Math.abs(n); String tmpDir = System.getProperty("java.io.tmpdir"); String fifoName = "fifo-" + n + ".tmp"; File fifo = new File(tmpDir, fifoName); Thread producerThread = null; try { Process mkFifoCommand = new ProcessBuilder("mkfifo", fifo.getCanonicalPath()).start(); mkFifoCommand.waitFor(); final String testFileContent = "This is test"; producerThread = new Thread(() -> { try { Files.write(fifo.toPath(), testFileContent.getBytes()); } catch (IOException e) { e.printStackTrace(); } }, "FIFO-Producer"); producerThread.start(); assertEquals(testFileContent, Utils.readFileAsString(fifo.getCanonicalPath())); } finally { Files.deleteIfExists(fifo.toPath()); if (producerThread != null) { producerThread.join(60 * 1000); assertFalse(producerThread.isAlive()); } } }

Target:
public void testFileAsStringNamedPipe() throws Exception { Random random = new Random(); long n = random.nextLong(); n = n == Long.MIN_VALUE ? 0 : Math.abs(n); String tmpDir = System.getProperty("java.io.tmpdir"); String fifoName = "fifo-" + n + ".tmp"; File fifo = new File(tmpDir, fifoName); Thread producerThread = null; try { Process mkFifoCommand = new ProcessBuilder("mkfifo", fifo.getCanonicalPath()).start(); mkFifoCommand.waitFor(); final String testFileContent = "This is test"; producerThread = new Thread(() -> { try { Files.write(fifo.toPath(), testFileContent.getBytes()); } catch (IOException e) { fail("Error when producing to fifo : " + e.getMessage()); } }, "FIFO-Producer"); producerThread.start(); assertEquals(testFileContent, Utils.readFileAsString(fifo.getCanonicalPath())); } finally { Files.deleteIfExists(fifo.toPath()); if (producerThread != null) { producerThread.join(30 * 1000); assertFalse(producerThread.isAlive()); } } }
Source:
public void testRouterClosedDuringOperation() throws Exception { ServerErrorCode[] serverErrorCodes = new ServerErrorCode[9]; Arrays.fill(serverErrorCodes, ServerErrorCode.No_Error); initialize(9, false); writeBlobRecordToServers(serverErrorCodes); future = router.deleteBlob(blobIdString, new ClientCallback()); router.close(); try { future.get(); fail("Deletion should be unsuccessful. Exception is expected."); } catch (Exception e) { assertEquals("RouterErrorCode should be RouterClosed", RouterErrorCode.RouterClosed, ((RouterException) e.getCause()).getErrorCode()); } assertCloseCleanup(); }

Target:
public void testRouterClosedDuringOperation() throws Exception { ServerErrorCode[] serverErrorCodes = new ServerErrorCode[9]; Arrays.fill(serverErrorCodes, ServerErrorCode.No_Error); setServerResponse(false); presetServerErrorCode(serverErrorCodes); future = router.deleteBlob(blobIdString, new ClientCallback()); router.close(); try { future.get(); fail("Deletion should be unsuccessful. Exception is expected."); } catch (ExecutionException e) { assertEquals("RouterErrorCode should be RouterClosed", RouterErrorCode.RouterClosed, ((RouterException) e.getCause()).getErrorCode()); } }
Source:
public Response getFirmwareStatus(@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) String language, @PathParam("thingUID") @ApiParam(value = "thing") String thingUID) throws IOException { ThingUID thingUIDObject = new ThingUID(thingUID); FirmwareStatusInfo info = firmwareUpdateService.getFirmwareStatusInfo(thingUIDObject); if (info == null) { return JSONResponse.createErrorResponse(Status.NOT_FOUND, "Firmware status info not found"); } return Response.ok().entity(buildFirmwareDTO(info)).build(); }

Target:
public Response getFirmwareStatus(@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) String language, @PathParam("thingUID") @ApiParam(value = "thing") String thingUID) throws IOException { ThingUID thingUIDObject = new ThingUID(thingUID); FirmwareStatusInfo info = firmwareUpdateService.getFirmwareStatusInfo(thingUIDObject); if (info == null) { return JSONResponse.createErrorResponse(Status.NOT_FOUND, "Firmware status info not found."); } return Response.ok().entity(buildFirmwareStatusDTO(info)).build(); }
Source:
public byte[] encoded() { byte[] bytes; try { bytes = new Base64().encode(this.jwto.toString()); } catch (final IOException ignore) { bytes = new byte[] {}; } return bytes; }

Target:
public byte[] encoded() throws IOException { return new Base64().encode(this.jwto.toString()); }
Source:
public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(checkNotNull(input, "input") instanceof Map<?,?>, "this binder is only valid for Maps!"); checkNotNull(request, "request"); Map<String, String> userMetadata = Maps2.transformKeys((Map<String, String>) input, FN); Map<String, String> deletedMetadata = Maps.transformValues(userMetadata, FN2); return (R) request.toBuilder().replaceHeaders(Multimaps.forMap(deletedMetadata)).build(); }

Target:
public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(input instanceof Map<?,?>, "this binder is only valid for Maps!"); checkNotNull(request, "request"); Map<String, String> userMetadata = Maps2.transformKeys((Map<String, String>) input, transformHeaders); Map<String, String> deletedMetadata = Maps.transformValues(userMetadata, transformValues); return (R) request.toBuilder().replaceHeaders(Multimaps.forMap(deletedMetadata)).build(); }
Source:
public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { return OffsetDateTime.parse(defaultStr, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss[.SSS]x")); } catch (NumberFormatException e) { throw SqlExceptionUtil.create("Problems with field " + fieldType + " parsing default OffsetTime value: " + defaultStr, e); } }

Target:
public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { OffsetTime time = OffsetTime.parse(defaultStr, new DateTimeFormatterBuilder() .appendPattern("[yyyy-MM-dd ]HH:mm:ss") .appendFraction(ChronoField.NANO_OF_SECOND, 0, 9, true) .appendPattern("x") .toFormatter()); return javaToSqlArg(fieldType, time); } catch (NumberFormatException e) { throw SqlExceptionUtil.create("Problems with field " + fieldType + " parsing default OffsetTime value: " + defaultStr, e); } }
Source:
public void incrementRetryCounter(Collection<String> succeededUris) { this.retryCounter++; this.succeededUris = ImmutableSet.copyOf(succeededUris); }

Target:
public void incrementRetryCounter(Collection<String> succeededUris) { this.retryCounter++; this.succeededUris.addAll(succeededUris); }
Source:
public synchronized SecretKey loadSecretKeyForDecryption(String keyVersion) throws GeneralSecurityException, IOException { if (keyVersion.equals(VERSION_USER_DEFINED)) { return getSecretKey(AuthenticationSettings.INSTANCE.getSecretKeyData()); } if (keyVersion.equals(VERSION_ANDROID_KEY_STORE)) { if (Build.VERSION.SDK_INT >= 18) { return readSecretKeyFromKeyStoreForDecryption(); } else { throw new IllegalArgumentException( String.format( "keyVersion '%s' is not supported in this SDK. AndroidKeyStore is supported API18 and above.", keyVersion)); } } throw new IllegalArgumentException("keyVersion = " + keyVersion); }

Target:
synchronized SecretKey loadSecretKeyForDecryption(String keyVersion) throws GeneralSecurityException, IOException { if (mSecretKeyFromAndroidKeyStore != null) { return mSecretKeyFromAndroidKeyStore; } return getKey(keyVersion); }
Source:
public ITree parse(final StringReader reader) throws CommandSyntaxException { ResourceLocation location = ResourceLocation.read(reader); return TreeManager.treeRoot.getIndividualTemplates().stream().filter(a -> a.getGenome().getActiveAllele(TreeChromosomes.SPECIES).getRegistryName().equals(location)).findFirst().orElseThrow(() -> new SimpleCommandExceptionType(new LiteralMessage("Invalid Bee Type: " + location)).create()); }

Target:
public ITree parse(final StringReader reader) throws CommandSyntaxException { ResourceLocation location = ResourceLocation.read(reader); return TreeManager.treeRoot.templateAsIndividual(TreeManager.treeRoot.getTemplate(location.toString())); }
Source:
private String getter() { ImmutableList<String> topSpeciesNames = featuredSpeciesService.getSpeciesNamesSortedByExperimentCount(); return GSON.toJson( ImmutableMap.of( "topSpecies", topSpeciesNames.subList(0, Math.min(topSpeciesNames.size(), FEATURED_SPECIES)), "allSpecies", ImmutableList.sortedCopyOf(topSpeciesNames), "separator", ThreadLocalRandom.current().nextDouble() > 0.999 ? BEST_SEPARATOR : NORMAL_SEPARATOR)); }

Target:
private String getter() { ImmutableList<String> topSpeciesNames = featuredSpeciesService.getSpeciesNamesSortedByExperimentCount(); return GSON.toJson( ImmutableMap.of( "topSpecies", topSpeciesNames.subList(0, Math.min(topSpeciesNames.size(), FEATURED_SPECIES)), "allSpecies", ImmutableList.sortedCopyOf(topSpeciesNames))); }
Source:
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { if (entity instanceof Comment) { Comment comment = (Comment) entity; String commentCreationMessage = String.format("Comment created. URI: %s ", comment.getCommentUri()); kafkaEventProducer.send(new ProducerRecord<>("ambra-comment-created", commentCreationMessage)); } else if (entity instanceof Flag) { Flag flag = (Flag) entity; String flagCreationMessage = String.format("Comment flagged. URI: %s ", flag.getFlaggedComment().getCommentUri()); kafkaEventProducer.send(new ProducerRecord<>("ambra-flag-created", flagCreationMessage)); } return super.onSave(entity, id, state, propertyNames, types); }

Target:
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { if (entity instanceof Comment) { Comment comment = (Comment) entity; String commentCreationMessage = String.format("Comment created. URI: %s ", comment.getCommentUri()); sendMessage("ambra-comment-created", commentCreationMessage); } else if (entity instanceof Flag) { Flag flag = (Flag) entity; String flagCreationMessage = String.format("Comment flagged. URI: %s ", flag.getFlaggedComment().getCommentUri()); sendMessage("ambra-flag-created", flagCreationMessage); } else if (entity instanceof ArticleCategoryAssignmentFlag) { ArticleCategoryAssignmentFlag flag = (ArticleCategoryAssignmentFlag) entity; String flagCreationMessage = String.format("Category flagged. Article DOI: %s , Category: %s", flag.getArticle().getDoi(), flag.getCategory()); sendMessage("ambra-category-flag-created", flagCreationMessage); } return super.onSave(entity, id, state, propertyNames, types); }
Source:
public static Map<String, String> extractParameterFromMediaTypeString(String input) { int idx = input.indexOf(";"); if (idx < 0) { return Collections.emptyMap(); } input = input.substring(idx + 1); Map<String, String> result = Arrays.stream(input.split(",")) .map(s -> s.split("=")) .filter(a -> a.length == 2) .collect(Collectors.toMap( a -> a[0].trim(), a -> a[1].trim())); return result; }

Target:
public static Map<String, String> extractParameterFromMediaTypeString(String input) { int idx = input.indexOf(';'); if (idx < 0) { return Collections.emptyMap(); } input = input.substring(idx + 1); return Arrays.stream(input.split(",")) .map(s -> s.split("=")) .filter(a -> a.length == 2) .collect(Collectors.toMap( a -> a[0].trim(), a -> a[1].trim())); }
Source:
public void doVistRandomArticle() { final Bus bus = app.getBus(); Handler randomHandler = new Handler(new Handler.Callback(){ @Override public boolean handleMessage(Message msg) { RandomArticleIdTask randomTask = new RandomArticleIdTask(app.getAPIForSite(app.getPrimarySite()), app) { @Override public void onFinish(String message) { Log.d("Wikipedia", "Random article title pulled: " + message); if (message != null) { PageTitle title = new PageTitle(null, message, app.getPrimarySite()); HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_RANDOM); bus.post(new NewWikiPageNavigationEvent(title, historyEntry)); } else { Toast.makeText(app, app.getString(R.string.error_network_error), Toast.LENGTH_LONG).show(); } } @Override public void onCatch(Throwable caught) { Log.d("Wikipedia", "Random article ID retrieval failed"); curRandomArticleIdTask = null; } }; if (curRandomArticleIdTask != null) { curRandomArticleIdTask.cancel(); } curRandomArticleIdTask = randomTask; curRandomArticleIdTask.execute(); return true; } }); randomHandler.removeMessages(MESSAGE_RND); Message randomMessage = Message.obtain(); randomMessage.what = MESSAGE_RND; randomMessage.obj = "random"; randomHandler.sendMessage(randomMessage); }

Target:
public void doVistRandomArticle() { final Bus bus = app.getBus(); Handler randomHandler = new Handler(new Handler.Callback(){ @Override public boolean handleMessage(Message msg) { RandomArticleIdTask randomTask = new RandomArticleIdTask(app.getAPIForSite(app.getPrimarySite()), app) { @Override public void onFinish(String message) { Log.d("Wikipedia", "Random article title pulled: " + message); if (message != null) { PageTitle title = new PageTitle(null, message, app.getPrimarySite()); HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_RANDOM); bus.post(new NewWikiPageNavigationEvent(title, historyEntry)); } else { Toast.makeText(app, app.getString(R.string.error_network_error), Toast.LENGTH_LONG).show(); } } @Override public void onCatch(Throwable caught) { Log.d("Wikipedia", "Random article ID retrieval failed"); curRandomArticleIdTask = null; Toast.makeText(app, app.getString(R.string.error_network_error), Toast.LENGTH_LONG).show(); } }; if (curRandomArticleIdTask != null) { curRandomArticleIdTask.cancel(); } curRandomArticleIdTask = randomTask; curRandomArticleIdTask.execute(); return true; } }); randomHandler.removeMessages(MESSAGE_RND); Message randomMessage = Message.obtain(); randomMessage.what = MESSAGE_RND; randomMessage.obj = "random"; randomHandler.sendMessage(randomMessage); }
Source:
public DDMStructure(String name, String description, List<FormPage> pages) { super(); this.name = name; this.description = description; this.pages = pages; this.fields = CollectionsKt.flatMap(pages, new Function1<FormPage, Iterable<? extends Field>>() { @Override public Iterable<? extends Field> invoke(FormPage formPage) { return formPage.getFields(); } }); parsed = true; }

Target:
public DDMStructure(String name, String description, List<FormPage> pages) { this.name = name; this.description = description; this.pages = pages; for (FormPage page : pages) { this.fields.addAll(page.getFields()); } parsed = true; }
Source:
public VdsUpdateRunTimeInfo(VdsManager vdsManager, VDS vds) { _vdsManager = vdsManager; _vds = vds; _firstStatus = _vds.getstatus(); servicePolicy = ServicePolicyFactory.getServicePolicyForVds(vds); _vmDict = TransactionSupport.executeInScope(TransactionScopeOption.Suppress, new TransactionMethod<Map<Guid, VM>>() { @Override public Map<Guid, VM> runInTransaction() { return DbFacade.getInstance().getVmDAO().getAllRunningByVds(_vds.getId()); } }); for (VM vm : _vmDict.values()) { if (vm.isStatusUp() && vm.getstatus() != VMStatus.Up) { runningVmsInTransition++; } } }

Target:
public VdsUpdateRunTimeInfo(VdsManager vdsManager, VDS vds) { _vdsManager = vdsManager; _vds = vds; _firstStatus = _vds.getstatus(); monitoringStrategy = MonitoringStrategyFactory.getMonitoringStrategyForVds(vds); _vmDict = TransactionSupport.executeInScope(TransactionScopeOption.Suppress, new TransactionMethod<Map<Guid, VM>>() { @Override public Map<Guid, VM> runInTransaction() { return DbFacade.getInstance().getVmDAO().getAllRunningByVds(_vds.getId()); } }); for (VM vm : _vmDict.values()) { if (vm.isStatusUp() && vm.getstatus() != VMStatus.Up) { runningVmsInTransition++; } } }
Source:
private boolean isThisFlatSynchronization(PerunSession sess, Group group) throws InternalErrorException, WrongAttributeAssignmentException, AttributeNotExistsException { Attribute flatSynchronzationAttr = getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GroupsManager.GROUPFLATSYNCHRONIZATION_ATTRNAME); boolean flatSynchronization = false; if(flatSynchronzationAttr != null && flatSynchronzationAttr.getValue() != null) { flatSynchronization = (Boolean) flatSynchronzationAttr.getValue(); } return flatSynchronization; }

Target:
private boolean isThisFlatSynchronization(PerunSession sess, Group group) throws InternalErrorException, WrongAttributeAssignmentException, AttributeNotExistsException { Attribute flatSynchronizationAttr = getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GroupsManager.GROUP_FLAT_SYNCHRONIZATION_ATTRNAME); boolean flatSynchronization = false; if(flatSynchronizationAttr != null && flatSynchronizationAttr.getValue() != null) { flatSynchronization = flatSynchronizationAttr.valueAsBoolean(); } return flatSynchronization; }
Source:
AuthenticationResult acquireTokenWithBrokerSilent() throws AuthenticationException { mAuthRequest.setVersion(AuthenticationContext.getVersionName()); mAuthRequest.setBrokerAccountName(mAuthRequest.getLoginHint()); final BrokerEvent brokerEvent = startBrokerTelemetryRequest(EventStrings.BROKER_REQUEST_SILENT); logBrokerVersion(brokerEvent); final AuthenticationResult authenticationResult; if (!StringExtensions.isNullOrBlank(mAuthRequest.getBrokerAccountName()) || !StringExtensions .isNullOrBlank(mAuthRequest.getUserId())) { Logger.v(TAG, "User is specified for background(silent) token request, trying to acquire token silently."); authenticationResult = mBrokerProxy.getAuthTokenInBackground(mAuthRequest, brokerEvent); if (null != authenticationResult) { brokerEvent.setServerErrorCode(authenticationResult.getServerErrorCode()); brokerEvent.setServerSubErrorCode(authenticationResult.getServerSubErrorCode()); brokerEvent.setRefreshTokenAge(authenticationResult.getRefreshTokenAge()); brokerEvent.setSpeRing(authenticationResult.getSpeRing()); } } else { Logger.v(TAG, "User is not specified, skipping background(silent) token request"); authenticationResult = null; } Telemetry.getInstance().stopEvent(brokerEvent.getTelemetryRequestId(), brokerEvent, EventStrings.BROKER_REQUEST_SILENT); return authenticationResult; }

Target:
AuthenticationResult acquireTokenWithBrokerSilent() throws AuthenticationException { mAuthRequest.setVersion(AuthenticationContext.getVersionName()); mAuthRequest.setBrokerAccountName(mAuthRequest.getLoginHint()); final BrokerEvent brokerEvent = startBrokerTelemetryRequest(EventStrings.BROKER_REQUEST_SILENT); logBrokerVersion(brokerEvent); final AuthenticationResult authenticationResult; if (!StringExtensions.isNullOrBlank(mAuthRequest.getBrokerAccountName()) || !StringExtensions .isNullOrBlank(mAuthRequest.getUserId())) { Logger.v(TAG, "User is specified for background(silent) token request, trying to acquire token silently."); authenticationResult = mBrokerProxy.getAuthTokenInBackground(mAuthRequest, brokerEvent); if (null != authenticationResult && null != authenticationResult.getCliTelemInfo()) { brokerEvent.setSpeRing(authenticationResult.getCliTelemInfo().getSpeRing()); } } else { Logger.v(TAG, "User is not specified, skipping background(silent) token request"); authenticationResult = null; } Telemetry.getInstance().stopEvent(brokerEvent.getTelemetryRequestId(), brokerEvent, EventStrings.BROKER_REQUEST_SILENT); return authenticationResult; }
Source:
private final void sendIntent() { Intent intent = new Intent(Intent.ACTION_BATTERY_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); try { mBatteryStats.setOnBattery(mPlugType == BATTERY_PLUGGED_NONE, mBatteryLevel); } catch (RemoteException e) { } int icon = getIcon(mBatteryLevel); intent.putExtra("status", mBatteryStatus); intent.putExtra("health", mBatteryHealth); intent.putExtra("present", mBatteryPresent); intent.putExtra("level", mBatteryLevel); intent.putExtra("scale", BATTERY_SCALE); intent.putExtra("icon-small", icon); intent.putExtra("plugged", mPlugType); intent.putExtra("voltage", mBatteryVoltage); intent.putExtra("temperature", mBatteryTemperature); intent.putExtra("technology", mBatteryTechnology); if (false) { Log.d(TAG, "updateBattery level:" + mBatteryLevel + " scale:" + BATTERY_SCALE + " status:" + mBatteryStatus + " health:" + mBatteryHealth + " present:" + mBatteryPresent + " voltage: " + mBatteryVoltage + " temperature: " + mBatteryTemperature + " technology: " + mBatteryTechnology + " AC powered:" + mAcOnline + " USB powered:" + mUsbOnline + " icon:" + icon ); } ActivityManagerNative.broadcastStickyIntent(intent, null); }

Target:
private final void sendIntent() { Intent intent = new Intent(Intent.ACTION_BATTERY_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); try { mBatteryStats.setOnBattery(mPlugType == BATTERY_PLUGGED_NONE, mBatteryLevel); } catch (RemoteException e) { } int icon = getIcon(mBatteryLevel); intent.putExtra("status", mBatteryStatus); intent.putExtra("health", mBatteryHealth); intent.putExtra("present", mBatteryPresent); intent.putExtra("level", mBatteryLevel); intent.putExtra("scale", BATTERY_SCALE); intent.putExtra("icon-small", icon); intent.putExtra("plugged", mPlugType); intent.putExtra("voltage", mBatteryVoltage); intent.putExtra("temperature", mBatteryTemperature); intent.putExtra("technology", mBatteryTechnology); if (false) { Log.d(TAG, "updateBattery level:" + mBatteryLevel + " scale:" + BATTERY_SCALE + " status:" + mBatteryStatus + " health:" + mBatteryHealth + " present:" + mBatteryPresent + " voltage: " + mBatteryVoltage + " temperature: " + mBatteryTemperature + " technology: " + mBatteryTechnology + " AC powered:" + mAcOnline + " USB powered:" + mUsbOnline + " icon:" + icon ); } ActivityManagerNative.broadcastStickyIntent(intent, null); }
Source:
public void readData(ObjectDataInput in) throws IOException { port = in.readInt(); type = in.readByte(); int len = in.readInt(); if (len > 0) { byte[] address = new byte[len]; in.readFully(address); host = bytesToString(address); socketAddr = new InetSocketAddress(host, port); } }

Target:
public void readData(ObjectDataInput in) throws IOException { port = in.readInt(); type = in.readByte(); int len = in.readInt(); if (len > 0) { byte[] address = new byte[len]; in.readFully(address); host = bytesToString(address); inetAddress = InetAddress.getByName(host); } }
Source:
public void onExternalViewChange(List<ExternalView> externalViewList, NotificationContext changeContext) { logger.info("ExternalView change triggered with: " + externalViewList); super.onExternalViewChange(externalViewList, changeContext); if (!externalViewChangeTriggered) { externalViewChangeTriggered = true; initialized.countDown(); } helixClusterManagerMetrics.externalViewChangeTriggerCount.inc(); }

Target:
public void onExternalViewChange(List<ExternalView> externalViewList, NotificationContext changeContext) { synchronized (notificationLock) { logger.trace("ExternalView change triggered with: {}", externalViewList); if (!externalViewChangeTriggered) { externalViewChangeTriggered = true; initialized.countDown(); } helixClusterManagerMetrics.externalViewChangeTriggerCount.inc(); } }
Source:
public boolean containsAuthToken(String token){ System.out.println("token passed for authentication:" + token); System.out.println("getAuthToken class name:" + getAuthToken().getClass().getName()); System.out.println("getAuthToken(0)" + getAuthToken().get(0).getAuthToken().toString()); System.out.println("getAuthToken(0) class name:" + getAuthToken().get(0).getClass().getName()); Iterator<AuthToken> iterator = getAuthToken().iterator(); while(iterator.hasNext()){ AuthToken t = iterator.next(); if(t.getAuthToken().equals(token)) return true; } return false; }

Target:
public boolean containsAuthToken(String token){ Iterator<AuthToken> iterator = getAuthToken().iterator(); while(iterator.hasNext()){ AuthToken t = iterator.next(); if(t.getAuthToken().equals(token)) return true; } return false; }