auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected boolean canDoAction() { boolean retVal = true; if (getVmTemplate() == null) { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } if (retVal && !VmTemplateHandler.isTemplateStatusIsNotLocked(getVmTemplateId())) { getReturnValue().getCanDoActionMessages() .add(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); retVal = false; } if (retVal) { DiskImageList images = templatesFromExport.get(LinqUtils.firstOrNull(templatesFromExport.keySet(), new Predicate<VmTemplate>() { @Override public boolean eval(VmTemplate t) { return t.getId().equals(getParameters().getVmTemplateId()); } })); if (images != null) { getParameters().setImages(Arrays.asList(images.getDiskImages())); } else { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } } if (retVal) { StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain()); retVal = validator.isDomainExistAndActive(getReturnValue().getCanDoActionMessages()); } if (retVal && getStorageDomain().getstorage_domain_type() != StorageDomainType.ImportExport) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); retVal = false; } if (retVal) { VmTemplate tmpl = DbFacade.getInstance().getVmTemplateDAO().get(getVmTemplateId()); if (tmpl != null) { retVal = (tmpl.getstatus() != VmTemplateStatus.Locked); if (!retVal) { getReturnValue().getCanDoActionMessages() .add(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); } } } return retVal; }

Target:
protected boolean canDoAction() { boolean retVal = true; if (getVmTemplate() == null) { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } if (retVal) { DiskImageList images = templatesFromExport.get(LinqUtils.firstOrNull(templatesFromExport.keySet(), new Predicate<VmTemplate>() { @Override public boolean eval(VmTemplate t) { return t.getId().equals(getParameters().getVmTemplateId()); } })); if (images != null) { getParameters().setImages(Arrays.asList(images.getDiskImages())); } else { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } } if (retVal) { StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain()); retVal = validator.isDomainExistAndActive(getReturnValue().getCanDoActionMessages()); } if (retVal && getStorageDomain().getstorage_domain_type() != StorageDomainType.ImportExport) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); retVal = false; } if (retVal) { VmTemplate tmpl = DbFacade.getInstance().getVmTemplateDAO().get(getVmTemplateId()); if (tmpl != null) { retVal = (tmpl.getstatus() != VmTemplateStatus.Locked); if (!retVal) { getReturnValue().getCanDoActionMessages() .add(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); } } } return retVal; }
Source:
private static void checkCompDenpendency(XMLResource xr, Map<String, XMLResource> rcmap) { if (xr.depends.size() > 0) { return; } for (String zkModule : ZK_MODULES) { if (zkModule.equals(xr.name)) return; } Element xrRoot = xr.document.getRootElement(); for (Element el :xrRoot.getElements("component")) { if (el.getElement("extends") == null) continue; List<Element> ambigComps = findAmbiguousComps(rcmap, el); if (! ambigComps.isEmpty()) { String strictStirng =xrRoot.getElement("strict").getText(); boolean strict = strictStirng == null ? false : Boolean.parseBoolean(strictStirng); String addonName = ""; for (Element ambigComp: ambigComps) { Element ambigRoot = ambigComp.getDocument().getRootElement(); addonName = addonName.concat("'").concat(ambigRoot.getElement("addon-name").getFirstChild().getNodeValue()).concat("', "); } String message = "In {}, you are extending component which is defined in {}please define <depends>element"; String[] messageArgs = new String[]{xr.url.toString(), el.getElementValue("extends", true), addonName}; warningMessage(message, messageArgs, strict); } } }

Target:
private static void checkCompDenpendency(XMLResource xr, Map<String, XMLResource> rcmap) { if (xr.depends.size() > 0) { return; } for (String zkModule : ZK_MODULES) { if (zkModule.equals(xr.name)) return; } Element xrRoot = xr.document.getRootElement(); Element strictElement = xrRoot.getElement("strict"); boolean strict = strictElement == null ? false : Boolean.parseBoolean(strictElement.getText(true)); for (Element el : xrRoot.getElements("component")) { if (el.getElement("extends") == null) continue; List<Element> ambigComps = findAmbiguousComps(rcmap, el); if (!ambigComps.isEmpty()) { StringBuilder addonNameBuilder = new StringBuilder(); String addonName = ""; for (Element ambigComp : ambigComps) { Element ambigRoot = ambigComp.getDocument().getRootElement(); addonNameBuilder.append("'").append(ambigRoot.getElement("addon-name").getFirstChild().getNodeValue()).append("', "); } String message = "In {}, you are extending component which is defined in {}please define <depends> element"; String[] messageArgs = new String[]{xr.url.toString(), el.getElementValue("extends", true), addonNameBuilder.toString()}; warningMessage(message, messageArgs, strict); } } }
Source:
public void expiration_task_starts_on_new_node_after_migration_when_there_is_expirable_entry() { Config config = new Config(); config.setProperty(taskPeriodSecondsPropName(), "1"); TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(); final HazelcastInstance node1 = factory.newHazelcastInstance(config); CacheManager cacheManager = createCacheManager(node1); Cache cache = cacheManager.createCache("test", new CacheConfig()); ((ICache) cache).put(1, 1, new ExpiryPolicy() { @Override public Duration getExpiryForCreation() { return Duration.ONE_HOUR; } @Override public Duration getExpiryForAccess() { return Duration.ONE_HOUR; } @Override public Duration getExpiryForUpdate() { return Duration.ONE_HOUR; } }); final HazelcastInstance node2 = factory.newHazelcastInstance(config); node1.shutdown(); assertTrueEventually(new AssertTask() { @Override public void run() { assertTrue("There should be one ClearExpiredRecordsTask started", hasClearExpiredRecordsTaskStarted(node2)); } }); }

Target:
public void expiration_task_starts_on_new_node_after_migration_when_there_is_expirable_entry() { Config config = new Config(); config.setProperty(taskPeriodSecondsPropName(), "1"); TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(); final HazelcastInstance node1 = factory.newHazelcastInstance(config); CacheManager cacheManager = createCacheManager(node1); Cache cache = cacheManager.createCache("test", new CacheConfig()); ((ICache) cache).put(1, 1, new HazelcastExpiryPolicy(ONE_HOUR, ONE_HOUR, ONE_HOUR)); final HazelcastInstance node2 = factory.newHazelcastInstance(config); node1.shutdown(); assertTrueEventually(new AssertTask() { @Override public void run() { assertTrue("There should be one ClearExpiredRecordsTask started", hasClearExpiredRecordsTaskStarted(node2)); } }); }
Source:
private String applyTemplate(Map<String, Serializable> map) { try { return template.apply(map); } catch (IOException ioe) { LOGGER.error("Unable to apply template '" + templateText + "'", ioe); } return null; }

Target:
private String applyTemplate(Map<String, Serializable> map) { try { return template.apply(map); } catch (IOException ioe) { LOGGER.error("Unable to apply template {}", templateText, ioe); } return null; }
Source:
public List<FileBlockInfo> getFileBlockInfos() { return new ArrayList<>(mFileBlockInfos.values()); }

Target:
public List<FileBlockInfo> getFileBlockInfos() { return mFileBlockInfoList; }
Source:
public void testHtml() { String simple = "<head></head>"; String normal = "<a href=\"www.tracecompass.org\">Trace Compass</a>"; String complexValid = "<body id=\"useless tag\">"+ "<div attribute=someattr> <a>\tSkip to main page <!-- Sign Up to our Newsletter --></a> "+ "</body>"; String broken1 = "<head><head>"; String broken2 = "<head></body>"; String broken3 = "Vince wants his name in the unit tests"; ToolTipString simpleHtml = ToolTipString.fromHtml(simple); ToolTipString normalHtml = ToolTipString.fromHtml(normal); ToolTipString complexHtml = ToolTipString.fromHtml(complexValid); ToolTipString brokenHtml1 = ToolTipString.fromHtml(broken1); ToolTipString brokenHtml2 = ToolTipString.fromHtml(broken2); ToolTipString brokenHtml3 = ToolTipString.fromHtml(broken3); assertNotNull(simpleHtml); assertNotNull(normalHtml); assertNotNull(complexHtml); assertNotNull(brokenHtml1); assertNotNull(brokenHtml2); assertNotNull(brokenHtml3); assertEquals("", simpleHtml.toString()); assertEquals("Trace Compass", normalHtml.toString()); assertEquals(" \tSkip to main page ", complexHtml.toString()); assertEquals("", brokenHtml1.toString()); assertEquals("", brokenHtml2.toString()); assertEquals(broken3, brokenHtml3.toString()); assertEquals(simple, simpleHtml.toHtmlString()); assertEquals(normal, normalHtml.toHtmlString()); assertEquals(complexValid, complexHtml.toHtmlString()); assertEquals(broken1, brokenHtml1.toHtmlString()); assertEquals(broken2, brokenHtml2.toHtmlString()); assertEquals(broken3, brokenHtml3.toHtmlString()); }

Target:
public void testHtml() { String simple = "<head></head>"; String normal = "<a href=\"www.tracecompass.org\">Trace Compass</a>"; String complexValid = "<body id=\"useless tag\">"+ "<div attribute=someattr> <a>\tSkip to main page <!-- Sign Up to our Newsletter --></a> "+ "</body>"; String broken1 = "<head><head>"; String broken2 = "<head></body>"; String broken3 = "Vince wants his name in the unit tests"; ToolTipString simpleHtml = ToolTipString.fromHtml(simple); ToolTipString normalHtml = ToolTipString.fromHtml(normal); ToolTipString complexHtml = ToolTipString.fromHtml(complexValid); ToolTipString brokenHtml1 = ToolTipString.fromHtml(broken1); ToolTipString brokenHtml2 = ToolTipString.fromHtml(broken2); ToolTipString brokenHtml3 = ToolTipString.fromHtml(broken3); assertEquals("", simpleHtml.toString()); assertEquals("Trace Compass", normalHtml.toString()); assertEquals(" \tSkip to main page ", complexHtml.toString()); assertEquals("", brokenHtml1.toString()); assertEquals("", brokenHtml2.toString()); assertEquals(broken3, brokenHtml3.toString()); assertEquals(simple, simpleHtml.toHtmlString()); assertEquals(normal, normalHtml.toHtmlString()); assertEquals(complexValid, complexHtml.toHtmlString()); assertEquals(broken1, brokenHtml1.toHtmlString()); assertEquals(broken2, brokenHtml2.toHtmlString()); assertEquals(broken3, brokenHtml3.toHtmlString()); }
Source:
private void initListeners() { listen(Message.BOOKMARKS, (sender, subject, args) -> { show(); }); listen(Message.LOADED, (sender, subject, args) -> { switch (subject) { case "known mutations": assert args[0] instanceof List<?>; List<KnownMutation> knownMutations = (List<KnownMutation>) args[0]; listItems.addAll(knownMutations); return; case "annotations": assert args[0] instanceof List<?>; List<GeneAnnotation> genes = (List<GeneAnnotation>) args[0]; listItems.addAll(genes); return; default: return; } }); }

Target:
private void initListeners() { listen(Message.BOOKMARKS, (sender, subject, args) -> setVisibility(true) ); listen(Message.LOADED, (sender, subject, args) -> { if ("known mutations".equals(subject) || "annotations".equals(subject)) { assert args[0] instanceof List<?>; List<AbstractBookmark> bookmarks = (List<AbstractBookmark>) args[0]; listItems.addAll(bookmarks); } }); }
Source:
public StringBuilder getTaskBoardStoryTaskListText(String filterName) { int storyLength = 0; ArrayList<TaskBoard_Story> storyList = new ArrayList<TaskBoard_Story>(); if ((mSprintBacklogMapper != null) && (mSprintBacklogMapper.getSprintId() > 0)) { ArrayList<StoryObject> stories = mSprintBacklogLogic.getStoriesByImp(); HashMap<Long, ArrayList<TaskObject>> storyToTasks = getStoryToTasksMap(stories); stories = filterStory(stories, storyToTasks, filterName); for (StoryObject story : stories) { storyList.add(create_TaskBoard_Story(story, storyToTasks.get(story.getId()))); } storyLength = stories.size(); } else { storyLength = 0; } Gson gson = new GsonBuilder().disableHtmlEscaping().create();; LinkedHashMap<String, Object> jsonMap = new LinkedHashMap<String, Object>(); jsonMap.put("Stories", storyList); jsonMap.put("success", true); jsonMap.put("Total", storyLength); return new StringBuilder(gson.toJson(jsonMap)); }

Target:
public StringBuilder getTaskBoardStoryTaskListText(String filterName) { int storyLength = 0; ArrayList<TaskBoard_Story> storyList = new ArrayList<TaskBoard_Story>(); if ((mSprintBacklogMapper != null) && (mSprintBacklogMapper.getSprintId() > 0)) { ArrayList<StoryObject> stories = mSprintBacklogLogic.getStoriesByImp(); HashMap<Long, ArrayList<TaskObject>> storyToTasks = getStoryToTasksMap(stories); stories = filterStory(stories, storyToTasks, filterName); for (StoryObject story : stories) { storyList.add(createTaskBoardStory(story, storyToTasks.get(story.getId()))); } storyLength = stories.size(); } else { storyLength = 0; } Gson gson = new GsonBuilder().disableHtmlEscaping().create();; LinkedHashMap<String, Object> jsonMap = new LinkedHashMap<String, Object>(); jsonMap.put("Stories", storyList); jsonMap.put("success", true); jsonMap.put("Total", storyLength); return new StringBuilder(gson.toJson(jsonMap)); }
Source:
public void deleteTenant(WebContext ctx, String tenantId) { Optional<Tenant> t = oma.find(Tenant.class, tenantId); if (t.isPresent()) { if (!Objects.equals(t.get().getId(), tenants.getRequiredTenant().getId())) { throw Exceptions.createHandled().withNLSKey("TenantController.cannotDeleteSelf").handle(); } oma.delete(t.get()); showDeletedMessage(); } tenants(ctx); }

Target:
public void deleteTenant(WebContext ctx, String tenantId) { Optional<Tenant> t = oma.find(Tenant.class, tenantId); if (t.isPresent()) { if (t.get().equals(tenants.getRequiredTenant())) { throw Exceptions.createHandled().withNLSKey("TenantController.cannotDeleteSelf").handle(); } oma.delete(t.get()); showDeletedMessage(); } tenants(ctx); }
Source:
public static URLConnection getConnection(String bucketName, String objectKey, String awsAccessKeyId, String awsAccessSecret) throws IOException { final String date = getDate(); final String payload = String.format(GET_PAYLOAD, date, bucketName, objectKey); final String signature = MD5Util.generateHMAC(payload, awsAccessSecret); final URL url = new URL(String.format(S3_URL, bucketName, objectKey)); final URLConnection conn = url.openConnection(); conn.setConnectTimeout(CONNECTION_TIMEOUT); conn.setReadTimeout(CONNECTION_TIMEOUT); conn.setRequestProperty("Date", date); conn.setRequestProperty("Authorization", "AWS " + awsAccessKeyId + ":" + signature); return conn; }

Target:
public static URLConnection getConnection(String bucketName, String objectKey, String awsAccessKeyId, String awsAccessSecret) throws IOException { final String date = getDate(); final String payload = String.format(GET_PAYLOAD, date, bucketName, objectKey); final String signature = MD5Util.generateHMAC(payload, awsAccessSecret); final URL url = new URL(String.format(S3_URL, bucketName, objectKey)); final URLConnection conn = url.openConnection(); conn.setConnectTimeout(CONNECTION_TIMEOUT); conn.setReadTimeout(CONNECTION_TIMEOUT); conn.addRequestProperty("Cache-Control", "no-cache,max-age=0"); conn.setRequestProperty("Date", date); conn.setRequestProperty("Authorization", "AWS " + awsAccessKeyId + ":" + signature); return conn; }
Source:
public String getPackageName() { if (clazz.getPackage() != null) { return clazz.getPackage().getName(); } return null; }

Target:
public String getPackageName() { if (clazz.getPackage() != null) { return clazz.getPackage().getName(); } return ""; }
Source:
public final void listReleaseAssets() throws java.io.IOException { final FakeRequest req = new FakeRequest(); final Coordinates.Simple coords = new Coordinates.Simple("test", "releases"); final Release release = new RtRelease( req, coords, 1 ); MatcherAssert.assertThat( release.iterate( req, coords ), Matchers.notNullValue() ); }

Target:
public final void listReleaseAssets() throws java.io.IOException { final FakeRequest req = new FakeRequest(); final Coordinates.Simple coords = new Coordinates.Simple("test", "releases"); final Release release = new RtRelease( req, coords, 1 ); MatcherAssert.assertThat( release.iterate( req, coords ), Matchers.instanceOf(Request.class) ); }
Source:
private List<OperatorDTO> adaptToOperatorDTOs(List<Operator> operators) { List<OperatorDTO> dtos = Lists.newArrayList(); for (Operator operator : operators) { dtos.add(new OperatorDTO(operator.id, operator.name, operator.state, operator.description, operator.domainName, operator.friendlyName)); } return dtos; }

Target:
private List<OperatorDTO> adaptToOperatorDTOs(List<Operator> operators) { List<OperatorDTO> dtos = Lists.newArrayList(); for (Operator operator : operators) { dtos.add(new OperatorDTO(operator.id.value, operator.name, operator.state.name(), operator.description, operator.domainName, operator.friendlyName, operator.emergencyNumber)); } return dtos; }
Source:
public void test_AllOf_LClass() { try { EnumSet.allOf((Class) null); fail("Should throw NullPointerException"); } catch (NullPointerException e) { } try { EnumSet.allOf(Enum.class); fail("Should throw ClassCastException"); } catch (ClassCastException cce) { } EnumSet<EnumFoo> enumSet = EnumSet.allOf(EnumFoo.class); assertEquals("Size of enumSet should be 64", 64, enumSet.size()); assertFalse( "enumSet should not contain null value", enumSet.contains(null)); assertTrue( "enumSet should contain EnumFoo.a", enumSet.contains(EnumFoo.a)); assertTrue( "enumSet should contain EnumFoo.b", enumSet.contains(EnumFoo.b)); enumSet.add(EnumFoo.a); assertSize(64, enumSet); EnumSet<EnumFoo> anotherSet = EnumSet.allOf(EnumFoo.class); assertEquals("Should be equal", enumSet, anotherSet); assertNotSame("Should not be identical", enumSet, anotherSet); EnumSet<HugeEnum> hugeEnumSet = EnumSet.allOf(HugeEnum.class); assertSize(65, hugeEnumSet); assertFalse(hugeEnumSet.contains(null)); assertTrue(hugeEnumSet.contains(HugeEnum.a)); assertTrue(hugeEnumSet.contains(HugeEnum.b)); hugeEnumSet.add(HugeEnum.a); assertSize(65, hugeEnumSet); EnumSet<HugeEnum> anotherHugeSet = EnumSet.allOf(HugeEnum.class); assertEquals(hugeEnumSet, anotherHugeSet); assertNotSame(hugeEnumSet, anotherHugeSet); }

Target:
public void test_AllOf_LClass() { try { EnumSet.allOf((Class) null); fail("Should throw NullPointerException"); } catch (NullPointerException e) { } try { EnumSet.allOf(Enum.class); fail("Should throw ClassCastException"); } catch (ClassCastException cce) { } EnumSet<EnumFoo> enumSet = EnumSet.allOf(EnumFoo.class); assertEquals("Size of enumSet should be 64", 64, enumSet.size()); assertFalse( "enumSet should not contain null value", enumSet.contains(null)); assertTrue( "enumSet should contain EnumFoo.a", enumSet.contains(EnumFoo.a)); assertTrue( "enumSet should contain EnumFoo.b", enumSet.contains(EnumFoo.b)); enumSet.add(EnumFoo.a); assertEquals("Should be equal", 64, enumSet.size()); EnumSet<EnumFoo> anotherSet = EnumSet.allOf(EnumFoo.class); assertEquals("Should be equal", enumSet, anotherSet); assertNotSame("Should not be identical", enumSet, anotherSet); EnumSet<HugeEnum> hugeEnumSet = EnumSet.allOf(HugeEnum.class); assertEquals(65, hugeEnumSet.size()); assertFalse(hugeEnumSet.contains(null)); assertTrue(hugeEnumSet.contains(HugeEnum.a)); assertTrue(hugeEnumSet.contains(HugeEnum.b)); hugeEnumSet.add(HugeEnum.a); assertEquals(65, hugeEnumSet.size()); EnumSet<HugeEnum> anotherHugeSet = EnumSet.allOf(HugeEnum.class); assertEquals(hugeEnumSet, anotherHugeSet); assertNotSame(hugeEnumSet, anotherHugeSet); }
Source:
public CompletionStage<Result> query() { try { final MetricsQuery query = parseQueryJson(); final CompletionStage<TimeSeriesResult> response = _queryExecutor.executeQuery(query.getQuery()); return response.<JsonNode>thenApply(_mapper::valueToTree).thenApply(Results::ok); } catch (final RuntimeException ex) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson(ex))); } catch (final ExecutionException ex) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson(ex.getProblems()))); } }

Target:
public CompletionStage<Result> query() { final JsonNode body = request().body().asJson(); if (body == null) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson("null body for query"))); } try { final MetricsQuery query = _mapper.treeToValue(body, MetricsQuery.class); final CompletionStage<TimeSeriesResult> response = _queryExecutor.executeQuery(query.getQuery()); return response.<JsonNode>thenApply(_mapper::valueToTree).thenApply(Results::ok); } catch (final RuntimeException ex) { return CompletableFuture.completedFuture(Results.internalServerError(createErrorJson(ex))); } catch (final QueryExecutionException ex) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson(ex.getProblems()))); } catch (final JsonProcessingException e) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson(e))); } }
Source:
public Map<String, Ref> getRemoteRefs() throws IOException { Map<String, Ref> matches = new HashMap<String, Ref>(); RefDatabase rdb = repository.getRefDatabase(); for (RefSpec spec : getSubscribeSpecs()) { String remoteRef; boolean isTag = spec.getSource().startsWith(Constants.R_TAGS); if (isTag) remoteRef = spec.getSource(); else remoteRef = getRemoteRefFromLocal(remote, spec.getSource()); Collection<Ref> c; if (spec.isWildcard()) { remoteRef = remoteRef.substring(0, remoteRef.length() - 1); c = rdb.getRefs(remoteRef).values(); } else { Ref r = rdb.getRef(remoteRef); if (r == null) continue; c = Collections.singleton(r); } for (Ref r : c) { if (isTag) matches.put(r.getName(), r); else matches.put(getLocalRefFromRemote(getRemote(), r.getName()), r); } } return matches; }

Target:
public Map<String, Ref> getRemoteRefs() throws IOException { if (remoteRefs == null) cacheRemoteRefs(); return remoteRefs; }
Source:
protected void handleStMgrRegisterRequest( REQID rid, SocketChannel channel, CheckpointManager.RegisterStMgrRequest request ) { LOG.info("Got a register request from " + request.getStmgrId() + " host:port " + channel.socket().getRemoteSocketAddress()); CheckpointManager.RegisterStMgrResponse.Builder responseBuilder = CheckpointManager.RegisterStMgrResponse.newBuilder(); if (!request.getTopologyName().equals(topologyName)) { LOG.severe("The register message was from a different topology: " + request.getTopologyName()); responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.NOTOK)); } else if (!request.getTopologyId().equals(topologyId)) { LOG.severe("The register message was from a different topology id: " + request.getTopologyName()); responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.NOTOK)); } else if (connection != null) { LOG.warning("We already have an active connection from the stmgr " + request.getStmgrId() + ". Closing existing connection..."); try { connection.close(); } catch (IOException e) { LOG.warning("Failed to close connection from: " + connection.socket().getRemoteSocketAddress()); } connection = null; responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.NOTOK)); } else { connection = channel; responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.OK)); } sendResponse(rid, channel, responseBuilder.build()); }

Target:
protected void handleStMgrRegisterRequest( REQID rid, SocketChannel channel, CheckpointManager.RegisterStMgrRequest request ) { LOG.info(String.format("Got a StMgr register request from %s running on host:port %s", request.getStmgrId(), channel.socket().getRemoteSocketAddress())); CheckpointManager.RegisterStMgrResponse.Builder responseBuilder = CheckpointManager.RegisterStMgrResponse.newBuilder(); if (!checkRegistrationValidity(request.getTopologyName(), request.getTopologyId())) { String errorMessage = String.format("The StMgr register message came with a different " + "topologyName: %s and/or topologyId: %s", request.getTopologyName(), request.getTopologyId()); LOG.severe(errorMessage); responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.NOTOK) .setMessage(errorMessage)); } else if (!checkExistingConnection()) { String errorMessage = "Please try again"; responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.NOTOK) .setMessage(errorMessage)); } else { connection = channel; responseBuilder.setStatus(Common.Status.newBuilder().setStatus(Common.StatusCode.OK)); } sendResponse(rid, channel, responseBuilder.build()); }
Source:
public void testOpenAndCloseConcurrency() { SWTBotUtil.createProject(TRACE_PROJECT_NAME); File fTestFile = new File(CTF_TRACE.getPath()); String path = fTestFile.getAbsolutePath(); assertNotNull(fTestFile); assumeTrue(fTestFile.exists()); final MultiStatus status = new MultiStatus("lttn2.kernel.ui.swtbot.tests", IStatus.OK, null, null); IJobManager mgr = Job.getJobManager(); JobChangeAdapter changeListener = new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { Job job = event.getJob(); if ((job.getName().startsWith("Running analysis")) && (job.getResult().getSeverity() == IStatus.ERROR)) { status.add(job.getResult()); } } }; mgr.addJobChangeListener(changeListener); for (int i = 0; i < 10; i++) { SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.delay(1000); workbenchbot.closeAllEditors(); if (!status.isOK()) { SWTBotUtil.deleteProject(TRACE_PROJECT_NAME, workbenchbot); fail(handleErrorStatus(status)); } } SWTBotUtil.deleteProject(TRACE_PROJECT_NAME, workbenchbot); }

Target:
public void testOpenAndCloseConcurrency() { SWTBotUtil.createProject(TRACE_PROJECT_NAME); File fTestFile = new File(CTF_TRACE.getPath()); String path = fTestFile.getAbsolutePath(); assertNotNull(fTestFile); assumeTrue(fTestFile.exists()); final MultiStatus status = new MultiStatus("lttn2.kernel.ui.swtbot.tests", IStatus.OK, null, null); IJobManager mgr = Job.getJobManager(); JobChangeAdapter changeListener = new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { Job job = event.getJob(); String jobNamePrefix = NLS.bind(Messages.TmfAbstractAnalysisModule_RunningAnalysis, ""); if ((job.getName().startsWith(jobNamePrefix)) && (job.getResult().getSeverity() == IStatus.ERROR)) { status.add(job.getResult()); } } }; mgr.addJobChangeListener(changeListener); for (int i = 0; i < 10; i++) { SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtil.delay(1000); workbenchbot.closeAllEditors(); if (!status.isOK()) { SWTBotUtil.deleteProject(TRACE_PROJECT_NAME, workbenchbot); fail(handleErrorStatus(status)); } } SWTBotUtil.deleteProject(TRACE_PROJECT_NAME, workbenchbot); }
Source:
private void createDiscrepancyNoteBean(String description, String detailedNotes, int itemDataId, StudyBean studyBean, UserAccountBean ub, DiscrepancyNoteBean parentDiscrepancyNote) { DiscrepancyNoteBean dnb = new DiscrepancyNoteBean(); dnb.setEntityId(itemDataId); dnb.setStudyId(studyBean.getId()); dnb.setEntityType(DiscrepancyNoteBean.ITEM_DATA); dnb.setDescription(description); dnb.setDetailedNotes(detailedNotes); dnb.setDiscrepancyNoteTypeId(parentDiscrepancyNote.getDiscrepancyNoteTypeId()); dnb.setResolutionStatusId(6); dnb.setColumn("value"); dnb.setAssignedUser(null); dnb.setOwner(ub); dnb.setParentDnId(parentDiscrepancyNote.getId()); dnb.setActivated(false); dnb = (DiscrepancyNoteBean) getDnDao().create(dnb); getDnDao().createMapping(dnb); DiscrepancyNoteBean itemParentNote = (DiscrepancyNoteBean) getDnDao().findByPK(dnb.getParentDnId()); itemParentNote.setResolutionStatusId(6); itemParentNote.setAssignedUser(null); itemParentNote.setOwner(ub); getDnDao().update(itemParentNote); getDnDao().updateAssignedUserToNull(itemParentNote); }

Target:
private void createDiscrepancyNoteBean(String description, String detailedNotes, int itemDataId, StudyBean studyBean, UserAccountBean ub, DiscrepancyNoteBean parentDiscrepancyNote) { DiscrepancyNoteBean dnb = new DiscrepancyNoteBean(); dnb.setEntityId(itemDataId); dnb.setStudyId(studyBean.getId()); dnb.setEntityType(DiscrepancyNoteBean.ITEM_DATA); dnb.setDescription(description); dnb.setDetailedNotes(detailedNotes); dnb.setDiscrepancyNoteTypeId(parentDiscrepancyNote.getDiscrepancyNoteTypeId()); dnb.setResolutionStatusId(ResolutionStatus.CLOSED_MODIFIED.getId()); dnb.setColumn("value"); dnb.setAssignedUser(null); dnb.setOwner(ub); dnb.setParentDnId(parentDiscrepancyNote.getId()); dnb.setActivated(false); dnb = (DiscrepancyNoteBean) getDnDao().create(dnb); getDnDao().createMapping(dnb); DiscrepancyNoteBean itemParentNote = (DiscrepancyNoteBean) getDnDao().findByPK(dnb.getParentDnId()); itemParentNote.setResolutionStatusId(ResolutionStatus.CLOSED_MODIFIED.getId()); itemParentNote.setAssignedUser(null); itemParentNote.setOwner(ub); getDnDao().update(itemParentNote); getDnDao().updateAssignedUserToNull(itemParentNote); }
Source:
public Environment findOne(String application, String profileList, String label) { final String defaultApplication = configServerProperties .getDefaultApplicationName(); final String defaultProfile = configServerProperties.getDefaultProfile(); if (StringUtils.isEmpty(application)) { application = defaultApplication; } if (StringUtils.isEmpty(profileList)) { profileList = defaultProfile; } String[] profiles = StringUtils.commaDelimitedListToStringArray(profileList); Environment environment = new Environment(application, profiles, label, null, null); Map<String, String> overrides = configServerProperties.getOverrides(); if (!overrides.isEmpty()) { environment.add(new PropertySource("overrides", overrides)); } for (String profile : profiles) { addPropertySource(environment, application, profile); if (!defaultApplication.equals(application)) { addPropertySource(environment, defaultApplication, profile); } } if (!Arrays.asList(profiles).contains(defaultProfile)) { addPropertySource(environment, application, defaultProfile); } if (!Arrays.asList(profiles).contains(defaultProfile) && !defaultApplication.equals(application)) { addPropertySource(environment, defaultApplication, defaultProfile); } if (!defaultApplication.equals(application)) { addPropertySource(environment, application, null); } addPropertySource(environment, defaultApplication, null); return environment; }

Target:
public Environment findOne(String application, String profileList, String label) { final String defaultApplication = configServerProperties .getDefaultApplicationName(); final String defaultProfile = configServerProperties.getDefaultProfile(); if (StringUtils.isEmpty(application)) { application = defaultApplication; } if (StringUtils.isEmpty(profileList)) { profileList = defaultProfile; } String[] profiles = StringUtils.trimArrayElements( StringUtils.commaDelimitedListToStringArray(profileList)); Environment environment = new Environment(application, profiles, label, null, null); Map<String, String> overrides = configServerProperties.getOverrides(); if (!overrides.isEmpty()) { environment.add(new PropertySource("overrides", overrides)); } for (String profile : profiles) { addPropertySource(environment, application, profile); if (!defaultApplication.equals(application)) { addPropertySource(environment, defaultApplication, profile); } } if (!Arrays.asList(profiles).contains(defaultProfile)) { addPropertySource(environment, application, defaultProfile); } if (!Arrays.asList(profiles).contains(defaultProfile) && !defaultApplication.equals(application)) { addPropertySource(environment, defaultApplication, defaultProfile); } if (!defaultApplication.equals(application)) { addPropertySource(environment, application, null); } addPropertySource(environment, defaultApplication, null); return environment; }
Source:
public long getSizeInBytes() { long buffersSizeInBytes = 0; if (blockEncodingBuffers != null) { for (int i = 0; i < channelCount; i++) { buffersSizeInBytes += blockEncodingBuffers[i].getSizeInBytes(); } } return Integer.BYTES * 2 * positionCount + buffersSizeInBytes; }

Target:
public long getSizeInBytes() { long buffersSizeInBytes = 0; if (blockEncodingBuffers != null) { for (int i = 0; i < channelCount; i++) { buffersSizeInBytes += blockEncodingBuffers[i].getSizeInBytes(); } } return SIZE_OF_INT * 2 * positionCount + buffersSizeInBytes; }
Source:
public JSONObject toJSONObject() throws JSONException { JSONObject jsonObject = new JSONObject().put("hostname", hostname).put("port", port) .put("hardwareState", dataNodeStatePolicy.isHardDown() ? HardwareState.UNAVAILABLE : HardwareState.AVAILABLE) .put("disks", new JSONArray()); for (Disk disk : disks) { jsonObject.accumulate("disks", disk.toJSONObject()); } for (String portType : ports.keySet()) { if (!portType.equalsIgnoreCase("plaintext")) { jsonObject.put(portType, ports.get(portType)); } } return jsonObject; }

Target:
public JSONObject toJSONObject() throws JSONException { JSONObject jsonObject = new JSONObject().put("hostname", hostname).put("port", port); addSSLPortToJson(jsonObject); jsonObject .put("hardwareState", dataNodeStatePolicy.isHardDown() ? HardwareState.UNAVAILABLE : HardwareState.AVAILABLE) .put("disks", new JSONArray()); for (Disk disk : disks) { jsonObject.accumulate("disks", disk.toJSONObject()); } return jsonObject; }
Source:
public long getSize(ParticipantStatus participantStatus, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return 0; }

Target:
public long getSize(ParticipantStatus participantStatus, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return -1; }
Source:
private DefaultLightblueBulkDataResponse simpleSetUp() throws Exception { DataBulkRequest bulkRequest = new DataBulkRequest(); DataFindRequest dfr = new DataFindRequest("foo", "bar"); dfr.select(Projection.includeField("*")); dfr.where(Query.regex("foo", "*", 0)); DataFindRequest dfr2 = new DataFindRequest("fooz", "bar"); dfr2.select(Projection.includeField("*")); dfr2.where(Query.regex("fooz", "*", 0)); bulkRequest.add(dfr); bulkRequest.add(dfr2); return new DefaultLightblueBulkDataResponse(jsonResponse, null, bulkRequest); }

Target:
private DefaultLightblueBulkDataResponse simpleSetUp() throws Exception { DataBulkRequest bulkRequest = new DataBulkRequest(); DataFindRequest dfr = new DataFindRequest("foo", "bar"); dfr.select(Projection.includeField("*")); dfr.where(Query.regex("foo", "*", 0)); DataFindRequest dfr2 = new DataFindRequest("fooz", "bar"); dfr2.select(Projection.includeField("*")); dfr2.where(Query.regex("fooz", "*", 0)); bulkRequest.add(dfr); bulkRequest.add(dfr2); return new DefaultLightblueBulkDataResponse(jsonResponse, bulkRequest); }
Source:
public void onApplicationEvent(ContextRefreshedEvent event) { if (!this.initialized.getAndSet(true)) { ConversionService conversionService = getConversionService(); if (conversionService == null) { conversionService = DefaultConversionService.getSharedInstance(); } for (Map.Entry<Object, NamedComponent> entry : this.mapping.entrySet()) { Object key = entry.getKey(); String channelKey; if (key instanceof String) { channelKey = (String) key; } else if (key instanceof Class) { channelKey = ((Class<?>) key).getName(); } else if (conversionService.canConvert(key.getClass(), String.class)) { channelKey = conversionService.convert(key, String.class); } else { throw new MessagingException("Unsupported channel mapping type for router [" + key.getClass() + "]"); } this.router.setChannelMapping(channelKey, entry.getValue().getComponentName()); } } }

Target:
public void onApplicationEvent(ContextRefreshedEvent event) { if (event.getApplicationContext() == getApplicationContext() && !this.initialized.getAndSet(true)) { ConversionService conversionService = getConversionService(); if (conversionService == null) { conversionService = DefaultConversionService.getSharedInstance(); } for (Map.Entry<Object, NamedComponent> entry : this.mapping.entrySet()) { Object key = entry.getKey(); String channelKey; if (key instanceof String) { channelKey = (String) key; } else if (key instanceof Class) { channelKey = ((Class<?>) key).getName(); } else if (conversionService.canConvert(key.getClass(), String.class)) { channelKey = conversionService.convert(key, String.class); } else { throw new MessagingException("Unsupported channel mapping type for router [" + key.getClass() + "]"); } this.router.setChannelMapping(channelKey, entry.getValue().getComponentName()); } } }
Source:
public PluginSelectionDialog(Shell parentShell, IPluginModelBase[] models, boolean multipleSelection) { super(parentShell, multipleSelection); fModels = models; setTitle(PDEUIMessages.PluginSelectionDialog_title); setMessage(PDEUIMessages.PluginSelectionDialog_message); PDEPlugin.getDefault().getLabelProvider().connect(this); setListLabelProvider(PDEPlugin.getDefault().getLabelProvider()); }

Target:
public PluginSelectionDialog(Shell parentShell, IPluginModelBase[] models, boolean multipleSelection) { super(parentShell, multipleSelection); configureModels(models, null); }
Source:
private static List<Concept> getConceptsFromFieldDescription( @Nullable String fieldDescription) { if (fieldDescription == null) { return Collections.emptyList(); } List<Concept> returnValue = new ArrayList<>(); try { SimpleObject extendedData = SimpleObject.parseJson(fieldDescription); Object object = extendedData.get("concepts"); if (! (object instanceof List)) { return Collections.emptyList(); } List list = (List) extendedData.get("concepts"); for (Object obj : list) { if (obj == null) { continue; } Integer conceptId = (Integer) obj; Concept concept = Context.getConceptService().getConcept(conceptId); if (concept == null) { continue; } returnValue.add(concept); } } catch (IOException ignore) { } return returnValue; }

Target:
private static List<Concept> getConceptsFromFieldDescription( @Nullable String fieldDescription) { if (fieldDescription == null) { return Collections.emptyList(); } List<Concept> returnValue = new ArrayList<>(); try { SimpleObject extendedData = SimpleObject.parseJson(fieldDescription); Object object = extendedData.get("concepts"); if (! (object instanceof List)) { return Collections.emptyList(); } List list = (List) object; for (Object obj : list) { if (obj == null) { continue; } Integer conceptId = (Integer) obj; Concept concept = Context.getConceptService().getConcept(conceptId); if (concept == null) { continue; } returnValue.add(concept); } } catch (IOException ignore) { } return returnValue; }
Source:
private synchronized boolean tryAcquirePersistentLock() { if (isShutDown) { log.info("The PersistentLockManager is shut down, and therefore rejected a request to acquire the lock."); return true; } Preconditions.checkState(lockId == null, "Acquiring a lock is unsupported when we've already acquired a lock"); try { lockId = persistentLockService.acquireBackupLock("Sweep"); log.info("Successfully acquired persistent lock for sweep: {}", SafeArg.of("lock id", lockId)); return true; } catch (CheckAndSetException e) { lockFailureMeter.mark(); log.info("Failed to acquire persistent lock for sweep. Waiting and retrying."); return false; } }

Target:
private synchronized boolean tryAcquirePersistentLock() { Preconditions.checkState(!isShutDown, "This PersistentLockManager is shut down, and cannot be used to acquire locks."); Preconditions.checkState(lockId == null, "Acquiring a lock is unsupported when we've already acquired a lock"); try { lockId = persistentLockService.acquireBackupLock("Sweep"); log.info("Successfully acquired persistent lock for sweep: {}", SafeArg.of("lock id", lockId)); return true; } catch (CheckAndSetException e) { lockFailureMeter.mark(); log.info("Failed to acquire persistent lock for sweep. Waiting and retrying."); return false; } }
Source:
public StyledString getStyledText(Object element) { String text = getText(element); if (text != null) { StyledString styledString = new StyledString(text); String reviewText = MessageFormat.format(" ({0}, {1})", ((ActivityEvent) element).getAttributes().get("author"), ((ActivityEvent) element).getDate()); styledString.append(reviewText, StyledString.DECORATIONS_STYLER); return styledString; } return new StyledString(); }

Target:
public StyledString getStyledText(Object element) { String text = getText(element); if (text != null) { StyledString styledString = new StyledString(text); String reviewText = NLS.bind(" ({0}, {1})", ((ActivityEvent) element).getAttributes().get("author"), ((ActivityEvent) element).getDate()); styledString.append(reviewText, StyledString.DECORATIONS_STYLER); return styledString; } return new StyledString(); }
Source:
protected void showDialog(Bundle state) { Context context = getContext(); Set<String> selected = getSharedPreferences().getStringSet(getKey(), new HashSet<>()); selected = new HashSet<>(selected); List<String> all = new ArrayList<>(selected); boolean connected = false; WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE); if (wifiManager != null) { WifiInfo info = wifiManager.getConnectionInfo(); if (info != null) { String ssid = info.getSSID(); if (ssid != "" && !ssid.contains("unknown ssid") && !selected.contains(ssid)) { all.add(ssid); connected = true; } } } if (!connected) { Toast.makeText(context, R.string.sync_only_wifi_ssids_connect_to_wifi, Toast.LENGTH_LONG).show(); } if (all.size() > 0 ) { setEntries(stripQuotes(all)); setEntryValues(all.toArray(new CharSequence[all.size()])); setValues(selected); super.showDialog(state); } String[] perms = Constants.getLocationPermissions(); boolean granted = true; for (int i = 0; i < perms.length; i++) { if (ContextCompat.checkSelfPermission(context, perms[i]) != PackageManager.PERMISSION_GRANTED) { granted = false; break; } } if (!granted) { if (context instanceof Activity) { Activity activity = (Activity) context; ActivityCompat.requestPermissions(activity, perms, Constants.PermissionRequestType.LOCATION.ordinal()); this.getDialog().dismiss(); } else { Toast.makeText(context, R.string.sync_only_wifi_ssids_need_to_grant_location_permission, Toast.LENGTH_LONG).show(); } } }

Target:
protected void showDialog(Bundle state) { Context context = getContext(); Set<String> selected = getSharedPreferences().getStringSet(getKey(), new HashSet<>()); selected = new HashSet<>(selected); List<String> all = new ArrayList<>(selected); boolean connected = false; WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE); if (wifiManager != null) { WifiInfo info = wifiManager.getConnectionInfo(); if (info != null) { String ssid = info.getSSID(); if (ssid != null && ssid != "" && !ssid.contains("unknown ssid")) { if (!selected.contains(ssid)) { all.add(ssid); } connected = true; } } } boolean hasPerms = hasLocationPermissions(); if (!connected) { if (!hasPerms) { Toast.makeText(context, R.string.sync_only_wifi_ssids_need_to_grant_location_permission, Toast.LENGTH_LONG).show(); } else { Toast.makeText(context, R.string.sync_only_wifi_ssids_connect_to_wifi, Toast.LENGTH_LONG).show(); } } if (all.size() > 0 ) { setEntries(stripQuotes(all)); setEntryValues(all.toArray(new CharSequence[all.size()])); setValues(selected); super.showDialog(state); } if (!hasPerms && context instanceof Activity) { Activity activity = (Activity) context; ActivityCompat.requestPermissions(activity, Constants.getLocationPermissions(), Constants.PermissionRequestType.LOCATION.ordinal()); } }
Source:
public int execute() { try { Hive hiveDb = getHive(); Path dumpRoot = new Path(conf.getVar(HiveConf.ConfVars.REPLDIR), Base64.getEncoder().encodeToString(work.dbNameOrPattern.toLowerCase() .getBytes(StandardCharsets.UTF_8.name()))); Path previousDumpMetaPath = getPreviousDumpMetadataPath(dumpRoot); Path previousHiveDumpPath = previousDumpMetaPath != null ? new Path(previousDumpMetaPath, ReplUtils.REPL_HIVE_BASE_DIR) : null; if (shouldDump(previousHiveDumpPath)) { Path currentDumpPath = new Path(dumpRoot, getNextDumpDir()); Path hiveDumpRoot = new Path(currentDumpPath, ReplUtils.REPL_HIVE_BASE_DIR); DumpMetaData dmd = new DumpMetaData(hiveDumpRoot, conf); ReplChangeManager.getInstance(conf); Path cmRoot = new Path(conf.getVar(HiveConf.ConfVars.REPLCMDIR)); Long lastReplId; if (previousHiveDumpPath == null) { lastReplId = bootStrapDump(hiveDumpRoot, dmd, cmRoot, hiveDb); } else { work.setEventFrom(getEventFromPreviousDumpMetadata(previousHiveDumpPath)); lastReplId = incrementalDump(hiveDumpRoot, dmd, cmRoot, hiveDb); } prepareReturnValues(Arrays.asList(currentDumpPath.toUri().toString(), String.valueOf(lastReplId))); writeDumpCompleteAck(hiveDumpRoot); deletePreviousDumpMeta(previousDumpMetaPath); } else { LOG.warn("Previous Dump is not yet loaded"); } } catch (Exception e) { LOG.error("failed", e); setException(e); return ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode(); } return 0; }

Target:
public int execute() { try { Hive hiveDb = getHive(); Path dumpRoot = new Path(conf.getVar(HiveConf.ConfVars.REPLDIR), Base64.getEncoder().encodeToString(work.dbNameOrPattern.toLowerCase() .getBytes(StandardCharsets.UTF_8.name()))); Path previousDumpMetaPath = getPreviousDumpMetadataPath(dumpRoot); Path previousHiveDumpPath = previousDumpMetaPath != null ? new Path(previousDumpMetaPath, ReplUtils.REPL_HIVE_BASE_DIR) : null; if (shouldDump(previousHiveDumpPath)) { Path currentDumpPath = new Path(dumpRoot, getNextDumpDir()); Path hiveDumpRoot = new Path(currentDumpPath, ReplUtils.REPL_HIVE_BASE_DIR); DumpMetaData dmd = new DumpMetaData(hiveDumpRoot, conf); ReplChangeManager.getInstance(conf); Path cmRoot = new Path(conf.getVar(HiveConf.ConfVars.REPLCMDIR)); Long lastReplId; if (previousHiveDumpPath == null) { lastReplId = bootStrapDump(hiveDumpRoot, dmd, cmRoot, hiveDb); } else { work.setEventFrom(getEventFromPreviousDumpMetadata(previousHiveDumpPath)); lastReplId = incrementalDump(hiveDumpRoot, dmd, cmRoot, hiveDb); } prepareReturnValues(Arrays.asList(currentDumpPath.toUri().toString(), String.valueOf(lastReplId))); writeDumpCompleteAck(hiveDumpRoot); deleteAllPreviousDumpMeta(dumpRoot, currentDumpPath); } else { LOG.warn("Previous Dump is not yet loaded"); } } catch (Exception e) { LOG.error("failed", e); setException(e); return ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode(); } return 0; }
Source:
private void onAssignmentRemoved(SubscriptionAssignment assignment) { assignments.remove(assignment); if (consumerNodeId.equals(assignment.getConsumerNodeId())) { callbacks.forEach(callback -> callback.onAssignmentRemoved(assignment.getSubscriptionName()) ); } removeSubscriptionEntryIfEmpty(assignment.getSubscriptionName()); }

Target:
private void onAssignmentRemoved(SubscriptionAssignment assignment) { try { if (assignments.remove(assignment) && consumerNodeId.equals(assignment.getConsumerNodeId())) { callbacks.forEach(callback -> callback.onAssignmentRemoved(assignment.getSubscriptionName())); } removeSubscriptionEntryIfEmpty(assignment.getSubscriptionName()); } catch (Exception e) { logger.error("Exception while removing assignment {}", assignment, e); } }
Source:
public static ColumnVector from(ColumnDescriptor descriptor) { switch (descriptor.getType()) { case BOOLEAN: return new BooleanColumnVector(); case DOUBLE: return new DoubleColumnVector(); case FLOAT: return new FloatColumnVector(); case INT32: return new IntColumnVector(); case INT64: return new LongColumnVector(); case BINARY: return new ByteColumnVector(1); case INT96: return new ByteColumnVector(12); case FIXED_LEN_BYTE_ARRAY: return new ByteColumnVector(descriptor.getTypeLength()); default: throw new IllegalArgumentException("Unhandled column type " + descriptor.getType()); } }

Target:
public static ColumnVector from(ColumnDescriptor descriptor) { switch (descriptor.getType()) { case BOOLEAN: return new BooleanColumnVector(); case DOUBLE: return new DoubleColumnVector(); case FLOAT: return new FloatColumnVector(); case INT32: return new IntColumnVector(); case INT64: return new LongColumnVector(); case BINARY: case INT96: case FIXED_LEN_BYTE_ARRAY: return new ByteColumnVector(); default: throw new IllegalArgumentException("Unhandled column type " + descriptor.getType()); } }