auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private WebDriver getWebDriverImpl( int requester, String providedBrowserId, String proxyAddress, int proxyPort) { ProvidedBrowser providedBrowser = getProvidedBrowser(providedBrowserId); if (providedBrowser == null) { throw new IllegalArgumentException("Unknown browser: " + providedBrowserId); } if (proxyAddress == null) { return webDriverProviders.get(providedBrowser.getProviderId()).getWebDriver(requester); } WebDriver wd = webDriverProviders .get(providedBrowser.getProviderId()) .getWebDriver(requester, proxyAddress, proxyPort); ExtensionScript extScript = Control.getSingleton().getExtensionLoader().getExtension(ExtensionScript.class); if (extScript != null) { List<ScriptWrapper> scripts = extScript.getScripts(SCRIPT_TYPE_SELENIUM); for (ScriptWrapper script : scripts) { try { if (script.isEnabled()) { SeleniumScript s = extScript.getInterface(script, SeleniumScript.class); if (s != null) { new Thread("ZAP-selenium-script") { @Override public void run() { s.browserLaunched( wd, requester, providedBrowserId, proxyAddress, proxyPort); } }.start(); } else { extScript.handleFailedScriptInterface( script, Constant.messages.getString( "selenium.scripts.interface.error", script.getName())); } } } catch (Exception e) { extScript.handleScriptException(script, e); } } } return wd; }

Target:
private WebDriver getWebDriverImpl( int requester, String providedBrowserId, String proxyAddress, int proxyPort) { ProvidedBrowser providedBrowser = getProvidedBrowser(providedBrowserId); if (providedBrowser == null) { throw new IllegalArgumentException("Unknown browser: " + providedBrowserId); } WebDriver wd; if (proxyAddress == null) { wd = webDriverProviders.get(providedBrowser.getProviderId()).getWebDriver(requester); } else { wd = webDriverProviders .get(providedBrowser.getProviderId()) .getWebDriver(requester, proxyAddress, proxyPort); } if (getExtScript() != null) { List<ScriptWrapper> scripts = extScript.getScripts(SCRIPT_TYPE_SELENIUM); for (ScriptWrapper script : scripts) { try { if (script.isEnabled()) { SeleniumScript s = extScript.getInterface(script, SeleniumScript.class); if (s != null) { new Thread("ZAP-selenium-script") { @Override public void run() { try { s.browserLaunched( new SeleniumScriptUtils( wd, requester, providedBrowserId, proxyAddress, proxyPort)); } catch (Exception e) { extScript.handleScriptException(script, e); } } }.start(); } else { extScript.handleFailedScriptInterface( script, Constant.messages.getString( "selenium.scripts.interface.error", script.getName())); } } } catch (Exception e) { extScript.handleScriptException(script, e); } } } return wd; }
Source:
private boolean findNextToken() { int totalLen = bytes.length; for (pos = end; pos < totalLen && bytes[pos] == '/'; pos++) { } if (pos == totalLen) { return hasCurrent = false; } for (end = pos + 1; end < totalLen && bytes[end] != '/'; end++) { } return hasCurrent = true; }

Target:
private boolean findNextToken() { int totalLen = path.length; for (pathOffset = pathEnd; pathOffset < totalLen && path[pathOffset] == '/'; pathOffset++) { } if (pathOffset == totalLen) return hasCurrent = false; for (pathEnd = pathOffset + 1; pathEnd < totalLen && path[pathEnd] != '/'; pathEnd++) { } return hasCurrent = true; }
Source:
public boolean hasEntity() { Object actualEntity = getActualEntity(); if (actualEntity == null) { return false; } else if (actualEntity instanceof InputStream) { final InputStream is = (InputStream) actualEntity; try { if (is.markSupported()) { is.mark(1); int i = is.read(); is.reset(); return i != -1; } else { try { if (is.available() > 0) { return true; } } catch (IOException ioe) { } int b = is.read(); if (b == -1) { return false; } PushbackInputStream pbis; if (is instanceof PushbackInputStream) { pbis = (PushbackInputStream) is; } else { pbis = new PushbackInputStream(is, 1); if (lastEntity != null) { lastEntity = pbis; } else { entity = pbis; } } pbis.unread(b); return true; } } catch (IOException ex) { throw new ProcessingException(ex); } } else { return true; } }

Target:
public boolean hasEntity() { Object actualEntity = getActualEntity(); if (actualEntity == null) { return false; } else if (actualEntity instanceof InputStream) { final InputStream is = (InputStream) actualEntity; try { if (is.markSupported()) { is.mark(1); int i = is.read(); is.reset(); return i != -1; } else { try { if (is.available() > 0) { return true; } } catch (IOException ioe) { } int b = is.read(); if (b == -1) { return false; } PushbackInputStream pbis; if (is instanceof PushbackInputStream) { pbis = (PushbackInputStream) is; } else { pbis = new PushbackInputStream(is, 1); if (lastEntity != null) { lastEntity = pbis; } else { entity = pbis; } } pbis.unread(b); return true; } } catch (IOException ex) { throw new ProcessingException(ex); } } return true; }
Source:
public void processElement(ProcessContext c) throws Exception { final String shardId = c.element().getKey(); final BoundedSource<Result> source = c.element().getValue(); LOG.info("Starting new shard"); final String finalFilePath = basePath + "/" + shardId; final SequenceFile.Writer.Option[] writerOptions = new SequenceFile.Writer.Option[]{ SequenceFile.Writer.file(new Path(finalFilePath)), SequenceFile.Writer.keyClass(ImmutableBytesWritable.class), SequenceFile.Writer.valueClass(Result.class), SequenceFile.Writer.compression(CompressionType.BLOCK) }; final long start = System.nanoTime(); long localStart = System.nanoTime(); long reportedTotalDuration = 0; try (BoundedSource.BoundedReader<Result> reader = source.createReader(c.getPipelineOptions())) { boolean hasMore = reader.start(); readDuration.addValue(System.nanoTime() - localStart); if (hasMore) { try (SequenceFile.Writer writer = SequenceFile.createWriter(hadoopConfig, writerOptions)) { final ImmutableBytesWritable key = new ImmutableBytesWritable(); Result value; while (hasMore) { localStart = System.nanoTime(); value = reader.getCurrent(); key.set(value.getRow()); writer.append(key, value); writeDuration.addValue(System.nanoTime() - localStart); localStart = System.nanoTime(); hasMore = reader.advance(); readDuration.addValue(System.nanoTime() - localStart); itemCounter.addValue(1L); final long newTotalDuration = System.nanoTime() - start; totalDuration.addValue(newTotalDuration - reportedTotalDuration); reportedTotalDuration = newTotalDuration; } bytesWritten.addValue(writer.getLength()); } } } final long newTotalDuration = System.nanoTime() - start; totalDuration.addValue(newTotalDuration - reportedTotalDuration); }

Target:
public void processElement(ProcessContext c) throws Exception { final ExportShard<Result> shard = c.element().getValue(); LOG.info("Starting new shard"); final String projectId = c.getPipelineOptions().as(DataflowPipelineOptions.class).getProject(); final String finalFilePath = basePath + "/" + shard.filename; try (BoundedSource.BoundedReader<Result> reader = shard.source.createReader(c.getPipelineOptions())) { if (!reader.start()) { return; } try (SequenceFile.Writer writer = createWriter(projectId, finalFilePath)) { final ImmutableBytesWritable key = new ImmutableBytesWritable(); Result value; long bytesReported = 0; boolean hasMore = true; while (hasMore) { value = reader.getCurrent(); key.set(value.getRow()); writer.append(key, value); hasMore = reader.advance(); itemCounter.addValue(1L); long newBytes = writer.getLength() - bytesReported; bytesWritten.addValue(newBytes); bytesReported += newBytes; } long newBytes = writer.getLength() - bytesReported; bytesWritten.addValue(newBytes); bytesReported += newBytes; } } }
Source:
public void placeEntity(World world, Entity entity, float yaw) { entity.setPosition(targetPos.getX() + 0.5, targetPos.getY(), targetPos.getZ() + 0.5); AxisAlignedBB aabb = entity.getEntityBoundingBox(); BlockPos min = new BlockPos(MathHelper.floor(aabb.minX), MathHelper.floor(aabb.minY), MathHelper.floor(aabb.minZ)); BlockPos max = new BlockPos(MathHelper.ceil(aabb.maxX), MathHelper.ceil(aabb.maxY), MathHelper.ceil(aabb.maxZ)); for (BlockPos pos : BlockPos.getAllInBoxMutable(min, max)) { world.setBlockToAir(pos); } }

Target:
public void placeEntity(World world, Entity entity, float yaw) { entity.moveToBlockPosAndAngles(targetPos, yaw, entity.rotationPitch); }
Source:
private void internalFreeMac(String mac) { if (allocatedMacs.containsKey(mac)) { removeMacFromMap(allocatedMacs, mac); availableMacs.add(mac); } else if (allocatedCustomMacs.containsKey(mac)) { removeMacFromMap(allocatedCustomMacs, mac); } }

Target:
private void internalFreeMac(String mac) { if (allocatedMacs.containsKey(mac)) { removeMacFromMap(allocatedMacs, mac); if (!allocatedMacs.containsKey(mac)) { availableMacs.add(mac); } } else if (allocatedCustomMacs.containsKey(mac)) { removeMacFromMap(allocatedCustomMacs, mac); } }
Source:
public void handle() { super.handle(); PrototypeFactory prototypeFactory = new LivePrototypeFactory(); try { CommCareConfigEngine engine = configureApp(args[0], prototypeFactory); ApplicationHost host = new ApplicationHost(engine, prototypeFactory); if (cmd.hasOption("r")) { host.setRestoreToLocalFile(cmd.getOptionValue("r")); } else { username = username.trim().toLowerCase(); host.setRestoreToRemoteUser(username, password); } host.run(); System.exit(-1); } catch (RuntimeException re) { System.out.print("Unhandled Fatal Error executing CommCare app"); re.printStackTrace(); throw re; } finally { System.exit(0); } }

Target:
public void handle() { super.handle(); PrototypeFactory prototypeFactory = new LivePrototypeFactory(); try { CommCareConfigEngine engine = configureApp(resourcePath, prototypeFactory); ApplicationHost host = new ApplicationHost(engine, prototypeFactory); if (cmd.hasOption("r")) { host.setRestoreToLocalFile(cmd.getOptionValue("r")); } else { username = username.trim().toLowerCase(); host.setRestoreToRemoteUser(username, password); } host.run(); System.exit(-1); } catch (RuntimeException re) { System.out.print("Unhandled Fatal Error executing CommCare app"); re.printStackTrace(); throw re; } finally { System.exit(0); } }
Source:
public boolean setFontSizeMultiplier(int multiplier) { if (multiplier < getResources().getInteger(R.integer.minTextSizeMultiplier)) { multiplier = getResources().getInteger(R.integer.minTextSizeMultiplier); } else if (multiplier > getResources().getInteger(R.integer.maxTextSizeMultiplier)) { multiplier = getResources().getInteger(R.integer.maxTextSizeMultiplier); } if (multiplier != getTextSizeMultiplier()) { Prefs.setTextSizeMultiplier(multiplier); bus.post(new ChangeTextSizeEvent()); return true; } return false; }

Target:
public boolean setFontSizeMultiplier(int multiplier) { int minMultiplier = getResources().getInteger(R.integer.minTextSizeMultiplier); int maxMultiplier = getResources().getInteger(R.integer.maxTextSizeMultiplier); if (multiplier < minMultiplier) { multiplier = minMultiplier; } else if (multiplier > maxMultiplier) { multiplier = maxMultiplier; } if (multiplier != getTextSizeMultiplier()) { Prefs.setTextSizeMultiplier(multiplier); bus.post(new ChangeTextSizeEvent()); return true; } return false; }
Source:
public static Image map(RepoImage entity, Image template) { Image model = template != null ? template : new Image(); model.setId(entity.getRepoImageId()); model.setName(entity.getRepoImageName()); if (entity.isSetSize()) { model.setSize(entity.getSize().intValue()); } if (entity.isSetFileType()) { model.setFileType(map(entity.getFileType(), null)); } return model; }

Target:
public static Image map(RepoImage entity, Image template) { Image model = template != null ? template : new Image(); model.setId(entity.getRepoImageId()); model.setName(entity.getRepoImageName()); if (entity.getSize() != null) { model.setSize(entity.getSize()); } model.setFileType(map(entity.getFileType(), null)); return model; }
Source:
public void findSections() throws Exception { getClient().perform(get("/api/config/submissiondefinitions/traditional/sections")) .andExpect(status().isForbidden()); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/config/submissiondefinitions/traditional/sections")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._embedded.submissionsections", hasSize(5))) .andExpect(jsonPath("$._embedded.submissionsections", Matchers.hasItem( allOf( hasJsonPath("$.id", is("traditionalpageone")), hasJsonPath("$.sectionType", is("submission-form")), hasJsonPath("$.type", is("submissionsection")), hasJsonPath("$._links.config.href", is(REST_SERVER_URL + "config/submissionforms/traditionalpageone")), hasJsonPath("$._links.self.href", is(REST_SERVER_URL + "config/submissionsections/traditionalpageone")) )))) ; }

Target:
public void findSections() throws Exception { getClient().perform(get("/api/config/submissiondefinitions/traditional/sections")) .andExpect(status().isUnauthorized()); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/config/submissiondefinitions/traditional/sections")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._embedded.submissionsections", hasSize(5))) .andExpect(jsonPath("$._embedded.submissionsections", Matchers.hasItem( allOf( hasJsonPath("$.id", is("traditionalpageone")), hasJsonPath("$.sectionType", is("submission-form")), hasJsonPath("$.type", is("submissionsection")), hasJsonPath("$._links.config.href", is(REST_SERVER_URL + "config/submissionforms/traditionalpageone")), hasJsonPath("$._links.self.href", is(REST_SERVER_URL + "config/submissionsections/traditionalpageone")) )))) ; }
Source:
public int hashCode() { if(getName().equalsIgnoreCase("INBOX")){ String inbox = new String("INBOX") ; return inbox.hashCode(); } return getName().hashCode(); }

Target:
public int hashCode() { if (getName().equalsIgnoreCase("INBOX")) { return "INBOX".hashCode(); } return getName().hashCode(); }
Source:
public void doMain(String[] args) throws IOException { ParserProperties properties = ParserProperties.defaults().withUsageWidth(80); CmdLineParser parser = new CmdLineParser(this, properties); try { parser.parseArgument(args); } catch (CmdLineException e) { e.printStackTrace(); return; } if( arguments.isEmpty() ) System.out.println("No args given. Example useage: java SampleMain" + parser.printExample(OptionHandlerFilter.ALL)); System.out.println(out); if( recursive ) System.out.println("-r flag is set"); if( data ) System.out.println("-custom flag is set"); System.out.println("-str was "+str); if( num>=0 ) System.out.println("-n was "+num); System.out.println("other arguments are:"); for( String s : arguments ) System.out.println(s); }

Target:
public void doMain(String[] args) throws IOException { ParserProperties properties = ParserProperties.defaults().withUsageWidth(80); CmdLineParser parser = new CmdLineParser(this, properties); try { parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(e.getMessage()+"\n"); System.err.println("java SampleMain [options...] arguments..."); parser.printUsage(System.err); System.err.println(); return; } if( arguments.isEmpty() ) System.err.println("No args given. Example useage: java SampleMain" + parser.printExample(OptionHandlerFilter.ALL)); System.out.println(out); if( recursive ) System.out.println("-r flag is set"); if( data ) System.out.println("-custom flag is set"); System.out.println("-str was "+str); if( num>=0 ) System.out.println("-n was "+num); System.out.println("other arguments are:"); for( String s : arguments ) System.out.println(s); }
Source:
private static HttpServletRequest createRequest( final String[] projects, final String[] groups) { final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); Mockito.when(request.getParameterValues("project")).thenReturn(projects); Mockito.when(request.getParameterValues("group")).thenReturn(groups); return request; }

Target:
private static HttpServletRequest createRequest( final String[] projects, final String[] groups) { final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); Mockito.when(request.getParameterValues(PageConfig.PROJECT_PARAM_NAME)).thenReturn(projects); Mockito.when(request.getParameterValues(PageConfig.GROUP_PARAM_NAME)).thenReturn(groups); return request; }
Source:
private void updatePostUploadProgressBar(ProgressBar view, PostModel post) { if (UploadService.isPostUploadingOrQueued(post)) { view.setVisibility(View.VISIBLE); view.setProgress(Math.min(90, Math.round(UploadService.getMediaUploadProgressForPost(post) * 100))); } else { view.setVisibility(View.GONE); } }

Target:
private void updatePostUploadProgressBar(ProgressBar view, PostModel post) { if (UploadService.isPostUploadingOrQueued(post)) { view.setVisibility(View.VISIBLE); int overallProgress = Math.round(UploadService.getMediaUploadProgressForPost(post) * 100); view.setProgress(Math.min(MAX_DISPLAYED_UPLOAD_PROGRESS, overallProgress)); } else { view.setVisibility(View.GONE); } }
Source:
public void testPecanPie() { topLevelIngredient = new PecanPie().topLevelIngredient; setUp(); swappedIngredientList = Arrays.asList("dry_crust", "flaky_crust", "pie_crust", "pie_mix", "filling", "finished_filling", "PecanPie"); constituentNecessaryTraits = Arrays.asList("salt", "sugar"); constituentIngredients = new ArrayList<IngredientRecipe>(); constituentIngredientList = Arrays.asList("butter", "light_corn_syrup", "eggs", "flour", "pecans", "bourbon", "vanilla"); for (String ingredient : constituentIngredientList) { IngredientRecipe i = knowledgebase.getIngredient(ingredient); constituentIngredients.add(i); } useCount = new HashMap<String, Integer>(); useCount.put("butter", 2); useCount.put("light_corn_syrup", 1); useCount.put("eggs", 2); useCount.put("flour", 1); useCount.put("pecans", 1); useCount.put("vanilla", 1); useCount.put("bourbon", 1); useCount.put("white_sugar", 2); useCount.put("brown_sugar", 2); useCount.put("confectioners_sugar", 2); useCount.put("salt", 2); useCount.put("sea_salt", 2); testRecipe(); }

Target:
public void testPecanPie() { topLevelIngredient = new PecanPie().topLevelIngredient; this.setUp(); swappedIngredientList = Arrays.asList("dry_crust", "flaky_crust", "pie_crust", "pie_mix", "filling", "finished_filling", "PecanPie"); constituentNecessaryTraits = Arrays.asList("salt", "sugar"); constituentIngredients = new ArrayList<IngredientRecipe>(); constituentIngredientList = Arrays.asList("butter", "light_corn_syrup", "eggs", "flour", "pecans", "bourbon", "vanilla"); for (String ingredient : constituentIngredientList) { IngredientRecipe i = knowledgebase.getIngredient(ingredient); constituentIngredients.add(i); } useCount = new HashMap<String, Integer>(); useCount.put("butter", 2); useCount.put("light_corn_syrup", 1); useCount.put("eggs", 2); useCount.put("flour", 1); useCount.put("pecans", 1); useCount.put("vanilla", 1); useCount.put("bourbon", 1); useCount.put("white_sugar", 2); useCount.put("brown_sugar", 2); useCount.put("confectioners_sugar", 2); useCount.put("salt", 2); useCount.put("sea_salt", 2); this.testRecipe(); }
Source:
public void testAdapterReads(final String useFastAlgorithm) throws IOException { final File metricsTestDir = new File(TEST_DIR.getParentFile(), "metrics"); final File input = new File(metricsTestDir, "AlignedAdapterReads.sam"); final File outfile = File.createTempFile("test", ".wgs_metrics"); outfile.deleteOnExit(); final File ref = CHR_M_REFERENCE; final String[] args = new String[]{ "INPUT=" + input.getAbsolutePath(), "OUTPUT=" + outfile.getAbsolutePath(), "SAMPLE_SIZE=" + 10, "REFERENCE_SEQUENCE=" + ref.getAbsolutePath(), "USE_FAST_ALGORITHM=" + useFastAlgorithm }; Assert.assertEquals(runPicardCommandLine(args), 0); final MetricsFile<WgsMetrics, Comparable<?>> output = new MetricsFile<>(); try (FileReader reader = new FileReader(outfile)) { output.read(reader); } for (final WgsMetrics metrics : output.getMetrics()) { Assert.assertEquals(metrics.GENOME_TERRITORY, 16571); Assert.assertEquals(metrics.PCT_EXC_TOTAL, 1D); TestNGUtil.compareDoubleWithAccuracy(metrics.PCT_EXC_ADAPTER, 102 / (102 + 82D), 0.00001); TestNGUtil.compareDoubleWithAccuracy(metrics.PCT_EXC_MAPQ, 82 / (102 + 82D), 0.00001); Assert.assertEquals(metrics.PCT_EXC_DUPE, 0.0); Assert.assertEquals(metrics.PCT_EXC_UNPAIRED, 0.0); } }

Target:
public void testAdapterReads(final String useFastAlgorithm) throws IOException { final File metricsTestDir = new File(TEST_DIR.getParentFile(), "metrics"); final File input = new File(metricsTestDir, "AlignedAdapterReads.sam"); final File outfile = File.createTempFile("test", ".wgs_metrics"); outfile.deleteOnExit(); final String[] args = { "INPUT=" + input.getAbsolutePath(), "OUTPUT=" + outfile.getAbsolutePath(), "SAMPLE_SIZE=" + 10, "REFERENCE_SEQUENCE=" + CHR_M_REFERENCE.getAbsolutePath(), "USE_FAST_ALGORITHM=" + useFastAlgorithm }; Assert.assertEquals(runPicardCommandLine(args), 0); final MetricsFile<WgsMetrics, Comparable<?>> output = new MetricsFile<>(); try (FileReader reader = new FileReader(outfile)) { output.read(reader); } for (final WgsMetrics metrics : output.getMetrics()) { Assert.assertEquals(metrics.GENOME_TERRITORY, 16571); Assert.assertEquals(metrics.PCT_EXC_TOTAL, 1D); TestNGUtil.compareDoubleWithAccuracy(metrics.PCT_EXC_ADAPTER, 102 / (102 + 82D), 0.00001); TestNGUtil.compareDoubleWithAccuracy(metrics.PCT_EXC_MAPQ, 82 / (102 + 82D), 0.00001); Assert.assertEquals(metrics.PCT_EXC_DUPE, 0.0); Assert.assertEquals(metrics.PCT_EXC_UNPAIRED, 0.0); } }
Source:
private void validateContentAccessMode(Consumer consumer) throws BadRequestException { if (!consumer.getOwner().isAllowedContentAccessMode(consumer.getContentAccessMode())) { throw new BadRequestException(i18n.tr( "The consumer cannot use the supplied content access mode.")); } if (consumer.getContentAccessMode() != null && !consumer.getType().isManifest()) { throw new BadRequestException(i18n.tr( "The consumer cannot be assigned a content access mode.")); } }

Target:
private void validateContentAccessMode(Consumer consumer) throws BadRequestException { if (!consumer.getOwner().isAllowedContentAccessMode(consumer.getContentAccessMode())) { throw new BadRequestException(i18n.tr( "The consumer cannot use the supplied content access mode.")); } if (consumer.getContentAccessMode() != null && !consumer.isManifestDistributor()) { throw new BadRequestException(i18n.tr( "The consumer cannot be assigned a content access mode.")); } }
Source:
private void encodeDistribution(DBObject dbObject, Described entity) { TranslatorUtils.fromIterable(dbObject, DISTRIBUTION_KEY, entity.getDistributions(), new Function<Distribution, DBObject>() { @Override public DBObject apply(Distribution distribution) { return distributionTranslator.toDBObject(new BasicDBObject(), distribution); } }); }

Target:
private void encodeDistribution(DBObject dbObject, Described entity) { TranslatorUtils.fromIterable(dbObject, DISTRIBUTION_KEY, entity.getDistributions(), distribution -> distributionTranslator.toDBObject( new BasicDBObject(), distribution) ); }
Source:
public void flattenToBuffer(ByteBuffer buf) throws IOException { byte flags = 0; if (m_isSinglePartition) { flags |= SINGLE_PARTITION_MASK; } if (m_nPartitions != null) { flags |= N_PARTITION_MASK; } if (m_shouldReturnResultTables) { flags |= SHOULD_RETURN_TABLES_MASK; } if (m_shouldReturnResultTables) { flags |= SHOULD_RETURN_TABLES_MASK; } buf.put(VoltDbMessageFactory.IV2_INITIATE_TASK_ID); super.flattenToBuffer(buf); buf.putLong(m_clientInterfaceHandle); buf.putLong(m_connectionId); buf.put(flags); if (m_nPartitions != null) { buf.putShort((short) m_nPartitions.length); for (int i : m_nPartitions) { buf.putInt(i); } } m_invocation.flattenToBuffer(buf); assert(buf.capacity() == buf.position()); buf.limit(buf.position()); }

Target:
public void flattenToBuffer(ByteBuffer buf) throws IOException { byte flags = 0; if (m_isSinglePartition) { flags |= SINGLE_PARTITION_MASK; } if (m_isEveryPartition) { flags |= EVERY_PARTITION_MASK; } if (m_shouldReturnResultTables) { flags |= SHOULD_RETURN_TABLES_MASK; } if (m_nPartitions != null) { flags |= N_PARTITION_MASK; } buf.put(VoltDbMessageFactory.IV2_INITIATE_TASK_ID); super.flattenToBuffer(buf); buf.putLong(m_clientInterfaceHandle); buf.putLong(m_connectionId); buf.put(flags); if (m_nPartitions != null) { buf.putShort((short) m_nPartitions.length); for (int i : m_nPartitions) { buf.putInt(i); } } m_invocation.flattenToBuffer(buf); assert(buf.capacity() == buf.position()); buf.limit(buf.position()); }
Source:
public QueryResult<Alert> queryAlerts(final AlertQuery query) { assertIsOpen(); LOGGER.debug() .setMessage("Querying") .addData("queryAlerts", query) .log(); final PagedList<models.ebean.Alert> pagedAlerts = _alertQueryGenerator.createAlertQuery(this, query); final Long etag = _alertQueryGenerator.getEtag(this, query.getOrganization()); final List<Alert> values = new ArrayList<>(); pagedAlerts.getList().forEach(ebeanAlert -> values.add(convertFromEbeanAlert(ebeanAlert))); return new DefaultQueryResult<>(values, pagedAlerts.getTotalCount(), etag.toString()); }

Target:
public QueryResult<Alert> queryAlerts(final AlertQuery query) { assertIsOpen(); LOGGER.debug() .setMessage("Querying") .addData("query", query) .log(); final PagedList<models.ebean.Alert> pagedAlerts = createAlertQuery(_ebeanServer, query); final long etag = _ebeanServer.createQuery(AlertEtags.class) .where() .eq("organization.uuid", query.getOrganization().getId()) .findOneOrEmpty() .map(AlertEtags::getEtag) .orElse(0L); final List<Alert> values = new ArrayList<>(); pagedAlerts.getList().forEach(ebeanAlert -> values.add(convertFromEbeanAlert(ebeanAlert))); return new DefaultQueryResult<>(values, pagedAlerts.getTotalCount(), String.valueOf(etag)); }
Source:
private static List<String> findErlFiles(@NotNull Collection<String> removedFiles) { return ContainerUtil.filter(removedFiles, new Condition<String>() { @Override public boolean value(String s) { return s.endsWith(".erl"); } }); }

Target:
private static List<String> findErlFiles(@NotNull Collection<String> removedFiles) { return ContainerUtil.filter(removedFiles, new Condition<String>() { @Override public boolean value(String s) { return ErlangBuilderUtil.isSource(s); } }); }
Source:
private String computeMd5DigestOfPlugins() { try { String digestOfBundledFolder = md5DigestOfFolderContent(bundledPlugins); String digestOfExternalFolder = md5DigestOfFolderContent(externalPlugins); File tempFileToStoreMd5 = File.createTempFile("tempFileToStoreMd5", ".txt"); BufferedWriter writer = new BufferedWriter(new FileWriter(tempFileToStoreMd5)); writer.write(String.format("digestOfBundledFolder:" + digestOfBundledFolder + "\tdigestOfExternalFolder:" + digestOfExternalFolder)); writer.close(); return md5DigestOfFile(tempFileToStoreMd5); } catch (Exception e) { throw new RuntimeException(String.format("Could not compute md5 of plugins. Exception occurred: %s", e.getStackTrace())); } }

Target:
private String computeMd5DigestOfPlugins() { try { String digestOfBundledFolder = md5DigestOfFolderContent(bundledPlugins); String digestOfExternalFolder = md5DigestOfFolderContent(externalPlugins); String digestOfPlugins = digestOfBundledFolder + digestOfExternalFolder; return DigestUtils.md5Hex(digestOfPlugins); } catch (Exception e) { throw new RuntimeException(String.format("Could not compute md5 of plugins. Exception occurred: %s", e.getStackTrace())); } }
Source:
private void decodeFilterFlushLines(boolean endOfInput) throws IOException { in.flip(); while (true) { CoderResult result = decoder.decode(in, buf, endOfInput); if (result.isUnderflow()) { break; } else if (result.isOverflow()) { if (!filterFlushLines()) { buf.flip(); buf = CharBuffer.allocate(buf.capacity() + DEFAULT_DECODER_CAPACITY).put(buf); } } else { throw new IllegalStateException("CharsetDecoder is mis-configured. Result: " + result); } } in.compact(); }

Target:
private void decodeFilterFlushLines(boolean endOfInput) throws IOException { ensureOpen(); encodedBuf.flip(); while (true) { CoderResult result = decoder.decode(encodedBuf, decodedBuf, endOfInput); if (result.isUnderflow()) { break; } else if (result.isOverflow()) { if (!filterFlushLines()) { decodedBuf.flip(); decodedBuf = CharBuffer.allocate(decodedBuf.capacity() * 2).put(decodedBuf); } } else { throw new IllegalStateException("CharsetDecoder is mis-configured. Result: " + result); } } encodedBuf.compact(); }
Source:
public List<JsonEntityBean> getParentGroups(String target) { IGroupMember member = GroupService.getEntity(target, IPerson.class); Iterator<IEntityGroup> iterator = member.getAncestorGroups().iterator(); List<JsonEntityBean> parents = new ArrayList<JsonEntityBean>(); while (iterator.hasNext()) { parents.add(groupListHelper.getEntity(iterator.next())); } Collections.sort(parents); return parents; }

Target:
public List<JsonEntityBean> getParentGroups(String target) { IGroupMember member = GroupService.getEntity(target, IPerson.class); List<JsonEntityBean> parents = new ArrayList<>(); for (IEntityGroup ancestor : member.getAncestorGroups()) { parents.add(groupListHelper.getEntity(ancestor)); } Collections.sort(parents); return parents; }
Source:
public void testRawQuery() throws ErrnoException { for (Network network : getTestableNetworks()) { CountDownLatch latch = new CountDownLatch(1); final int TIMEOUT_MS = 12_000; final String dname = "www.google.com"; String msg = "Raw query " + dname; mDns.query(network, dname, CLASS_IN, TYPE_AAAA, FLAG_NO_CACHE_LOOKUP, mHandler, answer -> { if (answer == null) { fail(msg + " no answer returned"); } try { new CheckedDnsPacket(answer); Log.d(TAG, "Reported blob:" + byteArrayToHexString(answer)); latch.countDown(); } catch (DnsPacket.ParseException e) { Log.d(TAG, e.getMessage()); fail(msg + " no valid answer"); } } ); try { assertTrue(msg + " but no answer after " + TIMEOUT_MS + "ms.", latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)); } catch (InterruptedException e) { } } }

Target:
public void testRawQuery() throws ErrnoException { final String dname = "www.google.com"; final String msg = "Raw query " + dname; for (Network network : getTestableNetworks()) { final CountDownLatch latch = new CountDownLatch(1); mDns.query(network, dname, CLASS_IN, TYPE_AAAA, FLAG_NO_CACHE_LOOKUP, mHandler, answer -> { if (answer == null) { fail(msg + " no answer returned"); } try { assertValidAnswer(msg, new DnsAnswer(answer)); Log.d(TAG, "Reported blob:" + byteArrayToHexString(answer)); latch.countDown(); } catch (DnsPacket.ParseException e) { fail(msg + e.getMessage()); } } ); try { assertTrue(msg + " but no answer after " + TIMEOUT_MS + "ms.", latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)); } catch (InterruptedException e) { } } }
Source:
public Serializable getDocValue(String solrFieldName, Object docValue) { AttributeFormat format = getType(solrFieldName); if (AttributeFormat.SHORT.equals(format)) { return Short.parseShort(docValue.toString()); } else if (AttributeFormat.OBJECT.equals(format)) { try (ByteArrayInputStream bais = new ByteArrayInputStream((byte[]) docValue); ObjectInputStream in = new ObjectInputStream(bais)) { return (Serializable) in.readObject(); } catch (IOException e) { LOGGER.info("IO exception loading input document", e); } catch (ClassNotFoundException e) { LOGGER.info("Could not create object to return.", e); } return null; } else { return ((Serializable) docValue); } }

Target:
public Serializable getDocValue(String solrFieldName, Object docValue) { AttributeFormat format = getType(solrFieldName); if (AttributeFormat.SHORT.equals(format)) { return Short.parseShort(docValue.toString()); } else if (AttributeFormat.OBJECT.equals(format)) { try (ByteArrayInputStream bais = new ByteArrayInputStream((byte[]) docValue); ObjectInputStream in = new ObjectInputStream(bais)) { return (Serializable) in.readObject(); } catch (IOException e) { LOGGER.debug("IO exception loading input document", e); } catch (ClassNotFoundException e) { LOGGER.debug("Could not create object to return.", e); } return null; } else { return ((Serializable) docValue); } }
Source:
private void checkConstraintViolations(StudyIdentifier studyId, String taskId) { List<SchedulePlan> plans = schedulePlanService.getSchedulePlans(ClientInfo.UNKNOWN_CLIENT, studyId, false); SchedulePlan match = findFirstMatchingPlan(plans, taskId); if (match != null) { throw new ConstraintViolationException.Builder().withEntityKey("taskId", taskId) .withEntityKey("type", "CompoundActivityDefinition").withReferrerKey("guid", match.getGuid()) .withReferrerKey("type", "SchedulePlan").build(); } }

Target:
private void checkConstraintViolations(StudyIdentifier studyId, String taskId) { List<SchedulePlan> plans = schedulePlanService.getSchedulePlans(ClientInfo.UNKNOWN_CLIENT, studyId, true); SchedulePlan match = findFirstMatchingPlan(plans, taskId); if (match != null) { throw new ConstraintViolationException.Builder().withMessage( "Cannot delete compound activity definition: it is referenced by a schedule plan that is still accessible through the API") .withEntityKey("taskId", taskId).withEntityKey("type", "CompoundActivityDefinition") .withReferrerKey("guid", match.getGuid()).withReferrerKey("type", "SchedulePlan").build(); } }
Source:
public CheckResult check(Change c) { reset(); change = c; try { checkImpl(); CheckResult result = new CheckResult(); result.messages = messages; return result; } finally { if (rw != null) { rw.release(); } if (repo != null) { repo.close(); } } }

Target:
public List<String> check(Change c) { reset(); change = c; try { checkImpl(); return messages; } finally { if (rw != null) { rw.release(); } if (repo != null) { repo.close(); } } }
Source:
@Override public void close() throws Exception { if (input != null) { input.close(); } }

Target:
public final void close() throws Exception { if (input != null) { input.close(); } }
Source:
public void automaticHardwareIdSpecBuilderWrongDiskTest() { float disk = 10; AutomaticHardwareIdSpec.automaticHardwareIdSpecBuilder(2.0, 2048, -disk); }

Target:
public void automaticHardwareIdSpecBuilderWrongDiskTest() { AutomaticHardwareIdSpec.automaticHardwareIdSpecBuilder(2.0, 2048, Optional.of(-10.0f)); }
Source:
protected final Optional<PlanNodeStatsEstimate> doCalculate(UnionNode node, StatsProvider statsProvider, Lookup lookup, Session session, TypeProvider types) { checkArgument(!node.getSources().isEmpty(), "Empty Union is not supported"); Optional<PlanNodeStatsEstimate> estimate = Optional.empty(); for (int i = 0; i < node.getSources().size(); i++) { PlanNode source = node.getSources().get(i); PlanNodeStatsEstimate sourceStats = statsProvider.getStats(source); PlanNodeStatsEstimate sourceStatsWithMappedSymbols = mapToOutputSymbols(sourceStats, toListMultimap(node.getVariableMapping()), i); if (estimate.isPresent()) { estimate = Optional.of(addStatsAndCollapseDistinctValues(estimate.get(), sourceStatsWithMappedSymbols)); } else { estimate = Optional.of(sourceStatsWithMappedSymbols); } } return estimate; }

Target:
protected final Optional<PlanNodeStatsEstimate> doCalculate(UnionNode node, StatsProvider statsProvider, Lookup lookup, Session session, TypeProvider types) { checkArgument(!node.getSources().isEmpty(), "Empty Union is not supported"); Optional<PlanNodeStatsEstimate> estimate = Optional.empty(); for (int i = 0; i < node.getSources().size(); i++) { PlanNode source = node.getSources().get(i); PlanNodeStatsEstimate sourceStats = statsProvider.getStats(source); PlanNodeStatsEstimate sourceStatsWithMappedSymbols = mapToOutputSymbols(sourceStats, node, i); if (estimate.isPresent()) { estimate = Optional.of(addStatsAndCollapseDistinctValues(estimate.get(), sourceStatsWithMappedSymbols)); } else { estimate = Optional.of(sourceStatsWithMappedSymbols); } } return estimate; }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.fragment_description_edit, container, false); unbinder = ButterKnife.bind(this, view); getAppCompatActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(true); getAppCompatActivity().getSupportActionBar().setTitle(""); pageTitle = GsonUnmarshaller.unmarshal(PageTitle.class, getActivity().getIntent().getStringExtra(EXTRA_TITLE)); pageTitleText.setText(pageTitle.getDisplayText()); return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.fragment_description_edit, container, false); unbinder = ButterKnife.bind(this, view); pageTitle = GsonUnmarshaller.unmarshal(PageTitle.class, getActivity().getIntent().getStringExtra(EXTRA_TITLE)); pageTitleText.setText(pageTitle.getDisplayText()); return view; }
Source:
public void register(FContext context, FAsyncCallback callback) throws TException { long opId = context.getOpId(); if (handlers.containsKey(opId)) { throw new FException("context already registered"); } context.setOpId(NEXT_OP_ID.incrementAndGet()); handlers.put(opId, new Pair<>(callback, Thread.currentThread())); }

Target:
public void register(FContext context, FAsyncCallback callback) throws TException { if (handlers.containsKey(context.getOpId())) { throw new FException("context already registered"); } long opId = NEXT_OP_ID.incrementAndGet(); context.setOpId(opId); handlers.put(opId, new Pair<>(callback, Thread.currentThread())); }
Source:
private void checkTarFileSetAttributesAllowed() { if (getProject() == null || (isReference() && getRefid().getReferencedObject(getProject()) instanceof TarFileSet)) { checkAttributesAllowed(); } }

Target:
private void checkTarFileSetAttributesAllowed() { if (getProject() == null || (isReference() && (getRefid().getReferencedObject( getProject()) instanceof TarFileSet))) { checkAttributesAllowed(); } }
Source:
protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { HttpRequest request = (HttpRequest) msg; JsonObject root = Json.createReader( new StringReader(request.getContent().toString(StandardCharsets.US_ASCII))).readObject(); Position position = new Position(); position.setProtocol(getProtocolName()); position.setValid(true); position.setLatitude(root.getJsonNumber("lat").doubleValue()); position.setLongitude(root.getJsonNumber("lon").doubleValue()); try { position.setSpeed(UnitsConverter.knotsFromCps(root.getInt("vel"))); } catch (Exception e) { } try { position.setAltitude(root.getInt("alt")); } catch (Exception e) { } try { position.setCourse(root.getInt("cog")); } catch (Exception e) { } try { position.setAccuracy(root.getInt("acc")); } catch (Exception e) { } try { position.set("t", root.getString("t")); } catch (Exception e) { } try { position.set(Position.KEY_BATTERY, root.getInt("batt")); } catch (Exception e) { } long timestamp = root.getJsonNumber("tst").longValue(); if (timestamp < Integer.MAX_VALUE) { timestamp *= 1000; } position.setTime(new Date(timestamp)); DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, root.getString("tid")); if (deviceSession == null) { sendResponse(channel, HttpResponseStatus.BAD_REQUEST); return null; } position.setDeviceId(deviceSession.getDeviceId()); if (position.getFixTime() == null) { position.setTime(new Date()); } if (position.getDeviceId() != 0) { sendResponse(channel, HttpResponseStatus.OK); return position; } else { sendResponse(channel, HttpResponseStatus.BAD_REQUEST); return null; } }

Target:
protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { HttpRequest request = (HttpRequest) msg; JsonObject root = Json.createReader( new StringReader(request.getContent().toString(StandardCharsets.US_ASCII))).readObject(); Position position = new Position(); position.setProtocol(getProtocolName()); position.setValid(true); position.setLatitude(root.getJsonNumber("lat").doubleValue()); position.setLongitude(root.getJsonNumber("lon").doubleValue()); if (root.containsKey("vel")) { position.setSpeed(UnitsConverter.knotsFromCps(root.getInt("vel"))); } if (root.containsKey("alt")) { position.setAltitude(root.getInt("alt")); } if (root.containsKey("cog")) { position.setCourse(root.getInt("cog")); } if (root.containsKey("acc")) { position.setAccuracy(root.getInt("acc")); } if (root.containsKey("t")) { position.set("t", root.getString("t")); } if (root.containsKey("batt")) { position.set(Position.KEY_BATTERY, root.getInt("batt")); } if (root.containsKey("topic")) { position.set("topic", root.getString("topic")); } long timestamp = root.getJsonNumber("tst").longValue(); if (timestamp < Integer.MAX_VALUE) { timestamp *= 1000; } position.setTime(new Date(timestamp)); DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, root.getString("tid")); if (deviceSession == null) { sendResponse(channel, HttpResponseStatus.BAD_REQUEST); return null; } position.setDeviceId(deviceSession.getDeviceId()); sendResponse(channel, HttpResponseStatus.OK); return position; }
Source:
public void enqueueEduDocument(EduDocument eduDocument) throws IOException, MessageException { if (!(eduDocument.getAny() instanceof Payload)) { log.error("Message attachement not instance of Payload."); throw new MeldingsUtvekslingRuntimeException("Message attachement ("+eduDocument.getAny()+") not instance of " + ""+Payload.class); } byte[] decryptedAsicPackage = decrypt((Payload)eduDocument.getAny()); Map<String, byte[]> contentFromAsic = getContentFromAsic(decryptedAsicPackage); IncomingConversationResource message = IncomingConversationResource.of(eduDocument.getConversationId(), eduDocument.getSenderOrgNumber(), eduDocument.getReceiverOrgNumber(), "OEP"); contentFromAsic.keySet().forEach(k -> message.addFileRef(k)); String filedir = props.getNextbest().getFiledir(); if (!filedir.endsWith("/")) { filedir = filedir+"/"; } filedir = filedir+eduDocument.getConversationId()+"/"; File localFile = new File(filedir+props.getNextbest().getAsicfile()); localFile.getParentFile().mkdirs(); try { FileOutputStream os = new FileOutputStream(localFile); BufferedOutputStream bos = new BufferedOutputStream(os); bos.write(decryptedAsicPackage); bos.close(); repoIn.save(message); } catch (IOException e) { e.printStackTrace(); } }

Target:
public void enqueueEduDocument(EduDocument eduDocument) throws MessageException { if (!(eduDocument.getAny() instanceof Payload)) { log.error("Message attachement not instance of Payload."); throw new MeldingsUtvekslingRuntimeException("Message attachement ("+eduDocument.getAny()+") not instance of " + ""+Payload.class); } byte[] decryptedAsicPackage = decrypt((Payload)eduDocument.getAny()); List<String> contentFromAsic = getContentFromAsic(decryptedAsicPackage); IncomingConversationResource message = IncomingConversationResource.of(eduDocument.getConversationId(), eduDocument.getSenderOrgNumber(), eduDocument.getReceiverOrgNumber(), "OEP"); contentFromAsic.forEach(message::addFileRef); String filedir = props.getNextbest().getFiledir(); if (!filedir.endsWith("/")) { filedir = filedir+"/"; } filedir = filedir+eduDocument.getConversationId()+"/"; File localFile = new File(filedir+props.getNextbest().getAsicfile()); localFile.getParentFile().mkdirs(); try { FileOutputStream os = new FileOutputStream(localFile); BufferedOutputStream bos = new BufferedOutputStream(os); bos.write(decryptedAsicPackage); bos.close(); os.close(); repoIn.save(message); } catch (IOException e) { log.error("Could not write asic container to disc.", e); } }
Source:
public void execute() throws UpdateException, RestApiException { try { executeRefUpdates(); executeChangeOps(); reindexChanges(); gitRefUpdated.fire(project, batchRefUpdate); executePostOps(); } catch (UpdateException | RestApiException e) { throw e; } catch (Exception e) { Throwables.propagateIfPossible(e); throw new UpdateException(e); } }

Target:
public void execute() throws UpdateException, RestApiException { try { executeRefUpdates(); executeChangeOps(); reindexChanges(); if (batchRefUpdate != null) { gitRefUpdated.fire(project, batchRefUpdate); } executePostOps(); } catch (UpdateException | RestApiException e) { throw e; } catch (Exception e) { Throwables.propagateIfPossible(e); throw new UpdateException(e); } }
Source:
private void monitorEngineThreadPools() { try { threadPoolInfoMap.clear(); Arrays.asList(threadMXBean.getAllThreadIds()) .stream() .forEach(threadId -> processThread(threadMXBean.getThreadInfo(threadId))); StringJoiner info = new StringJoiner("\n", "ThreadPools Info\n", ""); threadPoolInfoMap.entrySet() .stream() .forEach(entry -> info.add(entry.getValue().toString())); log.info(info.toString()); } catch (Exception ex) { log.info("Exception", ex); } }

Target:
private void monitorEngineThreadPools() { try { threadPoolInfoMap.clear(); Arrays.asList(threadMXBean.getAllThreadIds()) .stream() .forEach(threadId -> processThread(threadMXBean.getThreadInfo(threadId))); threadPoolInfoMap.entrySet() .stream() .forEach(entry -> log.info(entry.getValue().toString())); } catch (Exception ex) { log.info("Error fetching thread pools data: {}", ex.getMessage()); log.debug("Exception", ex); } }
Source:
public KafkaIndexTask( @JsonProperty("id") String id, @JsonProperty("resource") TaskResource taskResource, @JsonProperty("dataSchema") DataSchema dataSchema, @JsonProperty("tuningConfig") KafkaTuningConfig tuningConfig, @JsonProperty("ioConfig") KafkaIOConfig ioConfig, @JsonProperty("context") Map<String, Object> context, @JacksonInject ChatHandlerProvider chatHandlerProvider, @JacksonInject AuthorizerMapper authorizerMapper ) { super( id == null ? makeTaskId(dataSchema.getDataSource(), RANDOM.nextInt()) : id, StringUtils.format("%s_%s", TYPE, dataSchema.getDataSource()), taskResource, dataSchema.getDataSource(), context ); this.dataSchema = Preconditions.checkNotNull(dataSchema, "dataSchema"); this.parser = Preconditions.checkNotNull((InputRowParser<ByteBuffer>) dataSchema.getParser(), "parser"); this.tuningConfig = Preconditions.checkNotNull(tuningConfig, "tuningConfig"); this.ioConfig = Preconditions.checkNotNull(ioConfig, "ioConfig"); this.chatHandlerProvider = Optional.fromNullable(chatHandlerProvider); this.authorizerMapper = authorizerMapper; this.endOffsets.putAll(ioConfig.getEndPartitions().getPartitionOffsetMap()); this.maxEndOffsets.putAll(endOffsets.entrySet() .stream() .collect(Collectors.toMap( Map.Entry::getKey, integerLongEntry -> Long.MAX_VALUE ))); this.topic = ioConfig.getStartPartitions().getTopic(); this.sequences = new CopyOnWriteArrayList<>(); this.publishExecService = MoreExecutors.listeningDecorator(Execs.singleThreaded("publish-driver")); }

Target:
public KafkaIndexTask( @JsonProperty("id") String id, @JsonProperty("resource") TaskResource taskResource, @JsonProperty("dataSchema") DataSchema dataSchema, @JsonProperty("tuningConfig") KafkaTuningConfig tuningConfig, @JsonProperty("ioConfig") KafkaIOConfig ioConfig, @JsonProperty("context") Map<String, Object> context, @JacksonInject ChatHandlerProvider chatHandlerProvider, @JacksonInject AuthorizerMapper authorizerMapper ) { super( id == null ? makeTaskId(dataSchema.getDataSource(), RANDOM.nextInt()) : id, StringUtils.format("%s_%s", TYPE, dataSchema.getDataSource()), taskResource, dataSchema.getDataSource(), context ); this.dataSchema = Preconditions.checkNotNull(dataSchema, "dataSchema"); this.parser = Preconditions.checkNotNull((InputRowParser<ByteBuffer>) dataSchema.getParser(), "parser"); this.tuningConfig = Preconditions.checkNotNull(tuningConfig, "tuningConfig"); this.ioConfig = Preconditions.checkNotNull(ioConfig, "ioConfig"); this.chatHandlerProvider = Optional.fromNullable(chatHandlerProvider); this.authorizerMapper = authorizerMapper; this.endOffsets.putAll(ioConfig.getEndPartitions().getPartitionOffsetMap()); this.maxEndOffsets.putAll(endOffsets.entrySet() .stream() .collect(Collectors.toMap( Map.Entry::getKey, integerLongEntry -> Long.MAX_VALUE ))); this.topic = ioConfig.getStartPartitions().getTopic(); this.sequences = new CopyOnWriteArrayList<>(); if (context != null && context.get(KafkaSupervisor.IS_INCREMENTAL_HANDOFF_SUPPORTED) != null && ((boolean) context.get(KafkaSupervisor.IS_INCREMENTAL_HANDOFF_SUPPORTED))) { useLegacy = false; } else { useLegacy = true; } }