auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void provisionVolumes( ComponentImpl component, Container container, MachineConfigImpl config) throws DevfileException { <START> for (org.eclipse.che.api.workspace.server.model.impl.devfile.VolumeImpl v : <END> component.getVolumes()) { Optional<VolumeMount> sameNameMount = container .getVolumeMounts() .stream() .filter(volume -> volume.getName().equals(v.getName())) .findFirst(); if (sameNameMount.isPresent() && sameNameMount.get().getMountPath().equals(v.getContainerPath())) { continue; } else if (sameNameMount.isPresent()) { throw new DevfileException( format( "Conflicting volume with same name ('%s') but different path ('%s') found for component '%s' and its container '%s'.", v.getName(), v.getContainerPath(), getIdentifiableComponentName(component), container.getName())); } if (container .getVolumeMounts() .stream() .anyMatch(volume -> volume.getMountPath().equals(v.getContainerPath()))) { throw new DevfileException( format( "Conflicting volume with same path ('%s') but different name ('%s') found for component '%s' and its container '%s'.", v.getContainerPath(), v.getName(), getIdentifiableComponentName(component), container.getName())); } config.getVolumes().put(v.getName(), new VolumeImpl().withPath(v.getContainerPath())); } }</code><technical_language>rename variable for example componentVolume</technical_language>

Target:
private void provisionVolumes( ComponentImpl component, Container container, MachineConfigImpl config) throws DevfileException { for (org.eclipse.che.api.workspace.server.model.impl.devfile.VolumeImpl componentVolume : component.getVolumes()) { Optional<VolumeMount> sameNameMount = container .getVolumeMounts() .stream() .filter(vm -> vm.getName().equals(componentVolume.getName())) .findFirst(); if (sameNameMount.isPresent() && sameNameMount.get().getMountPath().equals(componentVolume.getContainerPath())) { continue; } else if (sameNameMount.isPresent()) { throw new DevfileException( format( "Conflicting volume with same name ('%s') but different path ('%s') found for component '%s' and its container '%s'.", componentVolume.getName(), componentVolume.getContainerPath(), getIdentifiableComponentName(component), container.getName())); } if (container .getVolumeMounts() .stream() .anyMatch(vm -> vm.getMountPath().equals(componentVolume.getContainerPath()))) { throw new DevfileException( format( "Conflicting volume with same path ('%s') but different name ('%s') found for component '%s' and its container '%s'.", componentVolume.getContainerPath(), componentVolume.getName(), getIdentifiableComponentName(component), container.getName())); } config .getVolumes() .put( componentVolume.getName(), new VolumeImpl().withPath(componentVolume.getContainerPath())); } }
Source:
<code><START> void sendSessionMessageToNonSessionEntity(MessagingEntityType entityType) { <END> setSenderAndReceiver(entityType, false); final String messageId = UUID.randomUUID().toString(); final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId); message.setSessionId("test-session-id1"); StepVerifier.create(sender.send(message).doOnSuccess(aVoid -> messagesPending.incrementAndGet())) .verifyComplete(); }</code><technical_language>sending a non-session message a session entity</technical_language>

Target:
void sendSessionMessageToNonSessionEntity(MessagingEntityType entityType) { setSenderAndReceiver(entityType, false, false); final String messageId = UUID.randomUUID().toString(); final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId); message.setSessionId(sessionId); StepVerifier.create(sender.send(message).doOnSuccess(aVoid -> messagesPending.incrementAndGet())) .verifyComplete(); }
Source:
<code>private List<TestFunctionality> getAvailableTestFunctionalities(final CertificationResult cr, final CertifiedProductSearchDetails cp) { String edition = cp.getCertificationEdition().get("name").toString(); Long practiceTypeId = null; if (cp.getPracticeType().containsKey("id")) { <START> if (cp.getPracticeType().get("id") instanceof String) { <END> practiceTypeId = Long.valueOf(cp.getPracticeType().get("id").toString()); } } String criteriaNumber = cr.getNumber(); return testFunctionalityManager.getTestFunctionalities(criteriaNumber, edition, practiceTypeId); }</code><technical_language>practiceType (cp.getPracticeType()) null? I piece of null before</technical_language>

Target:
private List<TestFunctionality> getAvailableTestFunctionalities(final CertificationResult cr, final CertifiedProductSearchDetails cp) { String edition = cp.getCertificationEdition().get("name").toString(); Long practiceTypeId = null; if (cp.getPracticeType().containsKey("id")) { if (cp.getPracticeType().get("id") != null) { practiceTypeId = Long.valueOf(cp.getPracticeType().get("id").toString()); } } String criteriaNumber = cr.getNumber(); return testFunctionalityManager.getTestFunctionalities(criteriaNumber, edition, practiceTypeId); }
Source:
<code>public static String getString(String key) { String value = System.getProperty(key); if (value != null) { if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, "Property (system): {0} => {1}", new Object[] {key, value}); } return value; } value = handler.getString(key); if (value != null) { if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, "Property (context): {0} => {1}", new Object[]{key, value}); } return value; } if (LOGGER.isLoggable(Level.CONFIG)) { <START> LOGGER.log(Level.CONFIG, "Property (not found): {0} => {1}", new Object[] {key, null}); <END> } return null; }</code><technical_language>I change message, sense print a value</technical_language>

Target:
public static String getString(String key) { String value = System.getProperty(key); if (value != null) { if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, "Property (system): {0} => {1}", new Object[] {key, value}); } return value; } value = handler.getString(key); if (value != null) { if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, "Property (context): {0} => {1}", new Object[]{key, value}); } return value; } if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, "Property (not found): {0}", key); } return null; }
Source:
<code>public DatabaseOperatorImpl(QueryRunner queryRunner){ this.queryRunner = queryRunner; <START> requireNonNull(queryRunner.getDataSource(), "data source must not be null."); <END> }</code><technical_language>i put requireNonNull(queryRunner.getDataSource(), "data source null.") this.queryRunner = queryRunner</technical_language>

Target:
public DatabaseOperatorImpl(QueryRunner queryRunner){ requireNonNull(queryRunner.getDataSource(), "data source must not be null."); this.queryRunner = queryRunner; }
Source:
<code>public void addItem() { String newList = newListInput.getText().toString().trim(); if (newList.isEmpty()) { UIUtils.showSnackbar(parent, getString(R.string.blank_list_name)); } else if (preferencesManager.getNameLists().contains(newList)) { String dupeMessage = String.format(listDuplicate, newList); UIUtils.showSnackbar(parent, dupeMessage); } else { newListInput.setText(""); nameListsAdapter.addList(newList); Intent intent = new Intent(this, ListActivity.class); intent.putExtra(LIST_NAME_KEY, newList); <START> intent.putExtra(LIST_TYPE, START_ON_EDIT_PAGE); <END> startActivity(intent); } }</code><technical_language>for miscommunication; I meant key be: public static final String START_ON_EDIT_PAGE = "startOnEditPage" pass in true here</technical_language>

Target:
public void addItem() { String newList = newListInput.getText().toString().trim(); if (newList.isEmpty()) { UIUtils.showSnackbar(parent, getString(R.string.blank_list_name)); } else if (preferencesManager.getNameLists().contains(newList)) { String dupeMessage = String.format(listDuplicate, newList); UIUtils.showSnackbar(parent, dupeMessage); } else { newListInput.setText(""); nameListsAdapter.addList(newList); Intent intent = new Intent(this, ListActivity.class); intent.putExtra(LIST_NAME_KEY, newList); intent.putExtra(START_ON_EDIT_PAGE, true); startActivity(intent); } }
Source:
<code>public void processVerification(String column, RoughArtifact roughArtifact) throws OseeCoreException { String[] keywords = <START> {"Effectivity:", "Verf Method:", "Verf Level:", "Verf Location:", "Verf Type:", "Verified By:", "Criteria:"}; <END> IAttributeType[] FieldType = { null, CoreAttributeTypes.QualificationMethod, CoreAttributeTypes.VerificationLevel, CoreAttributeTypes.VerificationEvent, null, null, null}; String trimmed = clearHTML(column); if (trimmed.trim().isEmpty()) { return; } for (int i = 0; i < keywords.length; i++) { if ((FieldType[i] == null) && (!keywords[i].equals("Criteria:"))) { continue; } int iStart = trimmed.indexOf(keywords[i]); if (iStart != -1) { boolean dataFound = true; String rest = trimmed.substring(iStart + keywords[i].length()); rest = rest.trim(); dataFound = !rest.isEmpty(); for (int j = 0; (j < keywords.length) && dataFound; j++) { dataFound = !rest.startsWith(keywords[j]); } if (dataFound) { int colon = rest.indexOf(':'); if (colon == -1) { if (keywords[i].equals("Criteria:")) { roughArtifact.addAttribute("Verification Acceptance Criteria", rest); } else { roughArtifact.addAttribute(FieldType[i], rest); } } else { boolean foundKeyword = false; for (int j = 0; (j < keywords.length); j++) { if (rest.indexOf(keywords[j]) == (colon - keywords[j].length() + 1)) { roughArtifact.addAttribute(FieldType[i], rest.substring(0, rest.indexOf(keywords[j]) - 1)); foundKeyword = true; break; } } if (!foundKeyword) { roughArtifact.addAttribute(FieldType[i], rest); } } } } } }</code><technical_language>this a constant</technical_language>

Target:
public void processVerification(String column, RoughArtifact roughArtifact) throws OseeCoreException { String trimmed = clearHTML(column); if (trimmed.trim().isEmpty()) { return; } for (int i = 0; i < VERIFICATION_KEYWORDS.length; i++) { if ((FIELD_TYPE[i] == null) && (!VERIFICATION_KEYWORDS[i].equals("Criteria:"))) { continue; } int iStart = trimmed.indexOf(VERIFICATION_KEYWORDS[i]); if (iStart != -1) { boolean dataFound = true; String rest = trimmed.substring(iStart + VERIFICATION_KEYWORDS[i].length()); rest = rest.trim(); dataFound = !rest.isEmpty(); for (int j = 0; (j < VERIFICATION_KEYWORDS.length) && dataFound; j++) { dataFound = !rest.startsWith(VERIFICATION_KEYWORDS[j]); } if (dataFound) { int colon = rest.indexOf(':'); if (colon == -1) { if (VERIFICATION_KEYWORDS[i].equals("Criteria:")) { roughArtifact.addAttribute("Verification Acceptance Criteria", rest); } else { roughArtifact.addAttribute(FIELD_TYPE[i], rest); } } else { boolean foundKeyword = false; for (int j = 0; (j < VERIFICATION_KEYWORDS.length); j++) { if (rest.indexOf(VERIFICATION_KEYWORDS[j]) == (colon - VERIFICATION_KEYWORDS[j].length() + 1)) { roughArtifact.addAttribute(FIELD_TYPE[i], rest.substring(0, rest.indexOf(VERIFICATION_KEYWORDS[j]) - 1)); foundKeyword = true; break; } } if (!foundKeyword) { roughArtifact.addAttribute(FIELD_TYPE[i], rest); } } } } } }
Source:
<code>synchronized void saveInAppMessage(OSInAppMessage inAppMessage) { SQLiteDatabase writableDb = dbHelper.getWritableDbWithRetries(); ContentValues values = new ContentValues(); values.put(OneSignalDbContract.InAppMessageTable.COLUMN_NAME_MESSAGE_ID, inAppMessage.messageId); values.put(OneSignalDbContract.InAppMessageTable.COLUMN_NAME_DISPLAY_QUANTITY, inAppMessage.getDisplayStats().getDisplayQuantity()); values.put(OneSignalDbContract.InAppMessageTable.COLUMN_NAME_LAST_DISPLAY, inAppMessage.getDisplayStats().getLastDisplayTime()); values.put(OneSignalDbContract.InAppMessageTable.COLUMN_CLICK_IDS, inAppMessage.getClickedClickIds().toString()); <START> values.put(OneSignalDbContract.InAppMessageTable.COLUMN_DISPLAYED, inAppMessage.isDisplayed() ? 1 : 0); <END> int rowsUpdated = writableDb.update(OneSignalDbContract.InAppMessageTable.TABLE_NAME, values, OneSignalDbContract.InAppMessageTable.COLUMN_NAME_MESSAGE_ID + " = ?", new String[]{inAppMessage.messageId}); if (rowsUpdated == 0) writableDb.insert(OneSignalDbContract.InAppMessageTable.TABLE_NAME, null, values); writableDb.close(); }</code><technical_language>**2 Questions:** 1. adding this new attribute IAM table require a migration? 2. a 1 a 0, a true false instead</technical_language>

Target:
synchronized void saveInAppMessage(OSInAppMessage inAppMessage) { SQLiteDatabase writableDb = dbHelper.getWritableDbWithRetries(); ContentValues values = new ContentValues(); values.put(OneSignalDbContract.InAppMessageTable.COLUMN_NAME_MESSAGE_ID, inAppMessage.messageId); values.put(OneSignalDbContract.InAppMessageTable.COLUMN_NAME_DISPLAY_QUANTITY, inAppMessage.getDisplayStats().getDisplayQuantity()); values.put(OneSignalDbContract.InAppMessageTable.COLUMN_NAME_LAST_DISPLAY, inAppMessage.getDisplayStats().getLastDisplayTime()); values.put(OneSignalDbContract.InAppMessageTable.COLUMN_CLICK_IDS, inAppMessage.getClickedClickIds().toString()); values.put(OneSignalDbContract.InAppMessageTable.COLUMN_DISPLAYED_IN_SESSION, inAppMessage.isDisplayedInSession()); int rowsUpdated = writableDb.update(OneSignalDbContract.InAppMessageTable.TABLE_NAME, values, OneSignalDbContract.InAppMessageTable.COLUMN_NAME_MESSAGE_ID + " = ?", new String[]{inAppMessage.messageId}); if (rowsUpdated == 0) writableDb.insert(OneSignalDbContract.InAppMessageTable.TABLE_NAME, null, values); writableDb.close(); }
Source:
<code>public void updatesWaitingSlotsToReady() throws Exception { <START> WorkflowID wfID1 = new WorkflowID("wf1"); <END> Schedule sch1 = new HourlySchedule(); SchedulingStrategy str1 = new SerialSchedulingStrategy(); Trigger tr1 = new AlwaysTrigger(); ExternalService srv1 = new MockExternalService(new MockExternalService.MockExternalStatusRunning()); Workflow wf1 = new Workflow(wfID1, sch1, str1, tr1, srv1); Set<Workflow> workflows = new HashSet<Workflow>(); workflows.add(wf1); WorkflowConfiguration cfg = new WorkflowConfiguration(workflows); MemoryStateDatabase db = new MemoryStateDatabase(); int slidingWindowHours = 24; DateTime current = DateTime.parse("2013-11-27T15:01Z"); DateTime currentFullHour = Util.toFullHour(current); Scheduler sched = new Scheduler(slidingWindowHours); sched.step(new ScheduledTime(current), cfg, db); Assert.assertEquals(slidingWindowHours, db.size()); for (int i = 0; i < slidingWindowHours; i++) { SlotID id = new SlotID(wfID1, new ScheduledTime(currentFullHour.minusHours(i))); SlotState state = db.getSlotState(id); if (state == null) { throw new AssertionError("Slot " + id + " not found."); } Assert.assertEquals(SlotState.Status.READY, state.getStatus()); } }</code><technical_language>do feel tests? a hard time them, for a couple of reasons. - more integration tests unit tests. Unit tests assert state of object test, interactions collaborating objects. (bar one) of assertions resulting database state. a getter method, step() is public method Scheduler. worth opening permissions (to package) some of other private methods allow more focused tests. I realize conventional test public methods of object, more focused tests increase confidence in them. - takes a lot of code set a workflow workflow configuration object, code this is repeated tests. Simply extracting a couple of helper methods for creating objects resulting code a lot easier digest, IMO</technical_language>

Target:
public void updatesWaitingSlotsToReady() throws Exception { WorkflowID wfID1 = new WorkflowID("wf1"); Schedule sch1 = new HourlySchedule(); SchedulingStrategy str1 = new SerialSchedulingStrategy(); Trigger tr1 = new AlwaysTrigger(); ExternalService srv1 = new MockExternalService(new MockExternalService.MockExternalStatusRunning()); Workflow wf1 = new Workflow(wfID1, sch1, str1, tr1, srv1); Set<Workflow> workflows = new HashSet<Workflow>(); workflows.add(wf1); WorkflowConfiguration cfg = new WorkflowConfiguration(workflows); MemoryStateDatabase db = new MemoryStateDatabase(); int slidingWindowHours = 24; DateTime current = DateTime.parse("2013-11-27T15:01Z"); DateTime currentFullHour = Util.toFullHour(current); Scheduler sched = new Scheduler(cfg, db, slidingWindowHours); sched.step(new ScheduledTime(current)); Assert.assertEquals(slidingWindowHours, db.size()); for (int i = 0; i < slidingWindowHours; i++) { SlotID id = new SlotID(wfID1, new ScheduledTime(currentFullHour.minusHours(i))); SlotState state = db.getSlotState(id); if (state == null) { throw new AssertionError("Slot " + id + " not found."); } Assert.assertEquals(SlotState.Status.READY, state.getStatus()); } }
Source:
<code>public String getEventString(int index) { <START> List<ITmfEventField> fields = Lists.newArrayList(getContent().getFields()); <END> if (index < 0 || index >= fields.size()) { return ""; } return nullToEmptyString(fields.get(index).getValue()); }</code><technical_language>Collection<? extends ITmfEventField> fields = getContent().getFields(); if (index < 0 || index >= fields.size()) { return ""; //$NON-NLS-1$ } return Iterables.get(fields, index).getValue().toString();</technical_language>

Target:
public String getEventString(int index) { Collection<? extends ITmfEventField> fields = getContent().getFields(); if (index < 0 || index >= fields.size()) { return ""; } return nullToEmptyString(checkNotNull(Iterables.get(fields, index)).getValue()); }
Source:
<code>private void writeEvents(EventsValue eventsValue, final JsonGenerator json) throws IOException { json.writeArrayFieldStart("Event"); json.writeStringField("namespace", eventsValue.namespace()); json.writeStringField("source", eventsValue.source()); json.writeStringField("title", eventsValue.title()); json.writeStringField("message", eventsValue.message()); json.writeStringField("priority", eventsValue.priority()); <START> json.writeStringField("status", eventsValue.status()); <END> json.writeStringField("timestamp", Long.toString(eventsValue.timestamp().epoch())); json.writeStringField("endTimestamp", Long.toString(eventsValue.endTimestamp().epoch())); json.writeStringField("userId", eventsValue.userId()); json.writeBooleanField("ongoing", eventsValue.ongoing()); json.writeStringField("eventId", eventsValue.eventId()); if (eventsValue.parentId() != null) { json.writeArrayFieldStart("parentId"); for (String p : eventsValue.parentId()) { json.writeString(p); } } if (eventsValue.childId() != null) { json.writeArrayFieldStart("childId"); for (String c : eventsValue.childId()) { json.writeString(c); } } if (eventsValue.additionalProps() != null) { for (Map.Entry<String, Object> e : eventsValue.additionalProps().entrySet()) { json.writeStringField(e.getKey(), String.valueOf(e.getValue())); } } json.writeEndArray(); }</code><technical_language>remove this</technical_language>

Target:
private void writeEvents(EventsValue eventsValue, final JsonGenerator json) throws IOException { json.writeArrayFieldStart("Event"); json.writeStringField("namespace", eventsValue.namespace()); json.writeStringField("source", eventsValue.source()); json.writeStringField("title", eventsValue.title()); json.writeStringField("message", eventsValue.message()); json.writeStringField("priority", eventsValue.priority()); json.writeStringField("timestamp", Long.toString(eventsValue.timestamp().epoch())); json.writeStringField("endTimestamp", Long.toString(eventsValue.endTimestamp().epoch())); json.writeStringField("userId", eventsValue.userId()); json.writeBooleanField("ongoing", eventsValue.ongoing()); json.writeStringField("eventId", eventsValue.eventId()); if (eventsValue.parentId() != null) { json.writeArrayFieldStart("parentId"); for (String p : eventsValue.parentId()) { json.writeString(p); } } if (eventsValue.childId() != null) { json.writeArrayFieldStart("childId"); for (String c : eventsValue.childId()) { json.writeString(c); } } if (eventsValue.additionalProps() != null) { for (Map.Entry<String, Object> e : eventsValue.additionalProps().entrySet()) { json.writeStringField(e.getKey(), String.valueOf(e.getValue())); } } json.writeEndArray(); }
Source:
<code>public void onUberfireDocksInteractionEvent(@Observes final UberfireDocksInteractionEvent uberfireDocksInteractionEvent) { <START> if (isUberfireDocksInteractionEventToManage(uberfireDocksInteractionEvent) && !uberfireDocksInteractionEvent.getTargetDock().getIdentifier().equals(TestToolsPresenter.IDENTIFIER)) { <END> populateRightDocks(uberfireDocksInteractionEvent.getTargetDock().getIdentifier()); } }</code><technical_language>getTargetDock().getIdentifier() is null? I suggest rewrite condition !TestToolsPresenter.IDENTIFIER.equals(uberfireDocksInteractionEvent.getTargetDock().getIdentifier())</technical_language>

Target:
public void onUberfireDocksInteractionEvent(@Observes final UberfireDocksInteractionEvent uberfireDocksInteractionEvent) { if (isUberfireDocksInteractionEventToManage(uberfireDocksInteractionEvent) && !TestToolsPresenter.IDENTIFIER.equals(uberfireDocksInteractionEvent.getTargetDock().getIdentifier())) { populateRightDocks(uberfireDocksInteractionEvent.getTargetDock().getIdentifier()); } }
Source:
<code>public io.druid.java.util.common.FileUtils.FileCopyResult getSegmentFiles( final String containerName, final String blobPath, final File outDir ) throws SegmentLoadingException { try { prepareOutDir(outDir); <START> log.info("Loading container: " + containerName + " - " + "blobPath:" + blobPath + " - outdir: " + outDir); <END> Boolean blobPathIsHadoop = blobPath.contains(HADOOP_BLOB_PATH_IDENTIFIER); final String actualBlobPath; if (blobPathIsHadoop) { actualBlobPath = blobPath.substring(blobPath.indexOf(HADOOP_BLOB_PATH_IDENTIFIER) + HADOOP_BLOB_PATH_IDENTIFIER.length() + 1); } else { actualBlobPath = blobPath; } final ByteSource byteSource = new AzureByteSource(azureStorage, containerName, actualBlobPath); final io.druid.java.util.common.FileUtils.FileCopyResult result = CompressionUtils.unzip( byteSource, outDir, AzureUtils.AZURE_RETRY, false ); log.info("Loaded %d bytes from [%s] to [%s]", result.size(), actualBlobPath, outDir.getAbsolutePath()); return result; } catch (IOException e) { try { FileUtils.deleteDirectory(outDir); } catch (IOException ioe) { log.warn( ioe, "Failed to remove output directory [%s] for segment pulled from [%s]", outDir.getAbsolutePath(), blobPath ); } throw new SegmentLoadingException(e, e.getMessage()); } }</code><technical_language>String.format syntax instead of string concats</technical_language>

Target:
public io.druid.java.util.common.FileUtils.FileCopyResult getSegmentFiles( final String containerName, final String blobPath, final File outDir ) throws SegmentLoadingException { try { prepareOutDir(outDir); log.info( "Loading container: [%s], with blobPath: [%s] and outDir: [%s]", containerName, blobPath, outDir ); boolean blobPathIsHadoop = blobPath.contains(AZURE_STORAGE_HOST_ADDRESS); final String actualBlobPath; if (blobPathIsHadoop) { actualBlobPath = blobPath.substring( blobPath.indexOf(AZURE_STORAGE_HOST_ADDRESS) + AZURE_STORAGE_HOST_ADDRESS.length() + 1); } else { actualBlobPath = blobPath; } final ByteSource byteSource = new AzureByteSource(azureStorage, containerName, actualBlobPath); final io.druid.java.util.common.FileUtils.FileCopyResult result = CompressionUtils.unzip( byteSource, outDir, AzureUtils.AZURE_RETRY, false ); log.info("Loaded %d bytes from [%s] to [%s]", result.size(), actualBlobPath, outDir.getAbsolutePath()); return result; } catch (IOException e) { try { FileUtils.deleteDirectory(outDir); } catch (IOException ioe) { log.warn( ioe, "Failed to remove output directory [%s] for segment pulled from [%s]", outDir.getAbsolutePath(), blobPath ); } throw new SegmentLoadingException(e, e.getMessage()); } }
Source:
<code><START> public View getView(final String name) throws CmdLineException { <END> ViewGroup group = Jenkins.getInstance(); View view = null; if (group == null) throw new CmdLineException(owner, "The Jenkins instance has not been started, or was already shut down!"); final StringTokenizer tok = new StringTokenizer(name, "/"); while(tok.hasMoreTokens()) { String viewName = tok.nextToken(); view = group.getView(viewName); if (view == null) throw new CmdLineException(owner, String.format( "No view named %s inside view %s", viewName, group.getDisplayName() )); view.checkPermission(View.READ); if (view instanceof ViewGroup) { group = (ViewGroup) view; } else if (tok.hasMoreTokens()) { throw new CmdLineException( owner, view.getViewName() + " view can not contain views" ); } } return view; }</code><technical_language>method throw RuntimeException if a user read permissions view. I suppose hasPermission() null result work</technical_language>

Target:
public View getView(final String name) throws CmdLineException { ViewGroup group = Jenkins.getInstance(); View view = null; if (group == null) throw new CmdLineException(owner, "The Jenkins instance has not been started, or was already shut down!"); final StringTokenizer tok = new StringTokenizer(name, "/"); while(tok.hasMoreTokens()) { String viewName = tok.nextToken(); view = group.getView(viewName); if (view == null) throw new CmdLineException(owner, String.format( "No view named %s inside view %s", viewName, group.getDisplayName() )); try { view.checkPermission(View.READ); } catch (Exception e) { throw new CmdLineException(owner, e.getMessage()); } if (view instanceof ViewGroup) { group = (ViewGroup) view; } else if (tok.hasMoreTokens()) { throw new CmdLineException( owner, view.getViewName() + " view can not contain views" ); } } return view; }
Source:
<code>public void export_system_credentials() throws Exception { CredentialsRootConfigurator root = Jenkins.getInstance() .getExtensionList(CredentialsRootConfigurator.class).get(0); ConfiguratorRegistry registry = ConfiguratorRegistry.get(); ConfigurationContext context = new ConfigurationContext(registry); Mapping configNode = Objects .requireNonNull(root.describe(root.getTargetComponent(context), context)).asMapping(); Mapping domainCredentials = configNode .get("system").asMapping().get("domainCredentials") .asSequence() .get(0).asMapping(); Mapping domain = domainCredentials.get("domain").asMapping(); Sequence credentials = domainCredentials.get("credentials").asSequence(); Mapping usernamePassword = credentials.get(0).asMapping().get("usernamePassword") .asMapping(); Mapping hostnameSpecification = domain.get("specifications").asSequence().get(0).asMapping() .get("hostnameSpecification").asMapping(); assertThat(usernamePassword.getScalarValue("scope"), is("SYSTEM")); assertThat(usernamePassword.getScalarValue("username"), is("root")); <START> assertThat(usernamePassword.getScalarValue("password"), is(not("password"))); <END> assertThat(domain.getScalarValue("name"), is("test.com")); assertThat(domain.getScalarValue("description"), is("test.com domain")); assertThat(hostnameSpecification.getScalarValue("includes"), is("*.test.com")); }</code><technical_language>decrypt Secret.decrypt check is is encrypted string</technical_language>

Target:
public void export_system_credentials() throws Exception { CredentialsRootConfigurator root = Jenkins.getInstance() .getExtensionList(CredentialsRootConfigurator.class).get(0); ConfiguratorRegistry registry = ConfiguratorRegistry.get(); ConfigurationContext context = new ConfigurationContext(registry); Mapping configNode = Objects .requireNonNull(root.describe(root.getTargetComponent(context), context)).asMapping(); Mapping domainCredentials = configNode .get("system").asMapping().get("domainCredentials") .asSequence() .get(0).asMapping(); Mapping domain = domainCredentials.get("domain").asMapping(); Sequence credentials = domainCredentials.get("credentials").asSequence(); Mapping usernamePassword = credentials.get(0).asMapping().get("usernamePassword") .asMapping(); Mapping hostnameSpecification = domain.get("specifications").asSequence().get(0).asMapping() .get("hostnameSpecification").asMapping(); String password = usernamePassword.getScalarValue("password"); Secret decryptedPassword = Secret.decrypt(password); assertNotNull(decryptedPassword); assertThat(usernamePassword.getScalarValue("scope"), is("SYSTEM")); assertThat(usernamePassword.getScalarValue("username"), is("root")); assertThat(password, is(not("password"))); assertThat(decryptedPassword.getPlainText(), is("password")); assertThat(domain.getScalarValue("name"), is("test.com")); assertThat(domain.getScalarValue("description"), is("test.com domain")); assertThat(hostnameSpecification.getScalarValue("includes"), is("*.test.com")); }
Source:
<code>protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { <START> Credentials credentials = getUserCredentials(request); <END> if (credentials != null) { request.getSession(true).setAttribute(SSOUtils.USER_CREDENTIALS, credentials); response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_PHASE3_URI); } else { response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_PHASE2_URI); } }</code><technical_language>if acceptBasic</technical_language>

Target:
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SSOConfig config = (SSOConfig) request.getServletContext().getAttribute(SSOUtils.SSO_CONFIG); Credentials credentials = null; if (config.isAcceptBasicAuthHeaders()) { credentials = SSOUtils.getUserCredentialsFromHeader(request); } if (credentials != null) { request.getSession(true).setAttribute(SSOUtils.USER_CREDENTIALS, credentials); response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_PHASE3_URI); } else { response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_PHASE2_URI); } }
Source:
<code>public boolean hasPrevious() { <START> return cursor != 0; <END> }</code><technical_language>cursor > 0</technical_language>

Target:
public boolean hasPrevious() { return cursor > 0; }
Source:
<code>private WatermarkConfiguration getDefaultWatermarkConf() { return PeriodicWatermarkConfiguration.newBuilder() .setWatermarkPeriod(DEFAULT_WATERMARK_PERIOD) <START> .setCheckpointPeriod(DEFAULT_CHECKPOINT_PERIOD) <END> .setExpectedDelay(DEFAULT_EXPECTED_DELAY) .build(); }</code><technical_language>if DEFAULT_CHECKPOINT_PERIOD is a multiple of DEFAULT_WATERMARK_PEROID</technical_language>

Target:
private WatermarkConfiguration getDefaultWatermarkConf() { return PeriodicWatermarkConfiguration.newBuilder() .setWatermarkPeriod(DEFAULT_WATERMARK_PERIOD) .setExpectedDelay(DEFAULT_EXPECTED_DELAY) .build(); }
Source:
<code>private short getPosition() { lock.lock(); try { serial.write(new byte[] {START_BYTE, maestro, COMMAND_GET_POSITION, channel}); <START> final ByteBuffer response = ByteBuffer.allocate(4).put(serial.read(), 0, 4); <END> return ByteBuffer.allocate(2).order(ByteOrder.LITTLE_ENDIAN).put( new byte[]{response.get(1), response.get(3)}).getShort(0); } catch (final IOException e) { Logger.error(e); return 0; } finally { lock.unlock(); } }</code><technical_language>This logic. serial read. putChar writes bytes buffer. This weird in place. jut write: return ByteBuffer.allocate(2).order(ByteOrder.LITTLE_ENDIAN).put( new byte[]{serial.read(), serial.read()}).getShort(0);</technical_language>

Target:
private short getPosition() { lock.lock(); try { serial.write(new byte[] {START_BYTE, maestro, COMMAND_GET_POSITION, channel}); final ByteBuffer response = ByteBuffer.allocate(4).put(serial.read(4)); return ByteBuffer.allocate(2).order(ByteOrder.LITTLE_ENDIAN).put( new byte[]{response.get(1), response.get(3)}).getShort(0); } catch (final IOException e) { Logger.error(e); return 0; } finally { lock.unlock(); } }
Source:
<code>void setup(View view, TriggerType triggerType, int position, long rowId) { if (triggerType == TriggerType.CLICK_LIST_ITEM) { view.setOnClickListener(this); view.setTag(LIST_POSITION_TAG.hashCode(), position); view.setTag(LIST_ROW_ID_TAG.hashCode(), rowId); } else if (triggerType == TriggerType.LONG_CLICK_LIST_ITEM) { view.setOnLongClickListener(this); <START> view.setTag(LIST_POSITION_TAG.hashCode(), position); <END> view.setTag(LIST_ROW_ID_TAG.hashCode(), rowId); } }</code><technical_language>resource Ids "key" in set tag</technical_language>

Target:
void setup(View view, TriggerType triggerType, int position, long rowId) { if (triggerType == TriggerType.CLICK_LIST_ITEM) { view.setOnClickListener(this); view.setTag(tagIdDefinition.getRowPositionTagResource(), position); view.setTag(tagIdDefinition.getRowIdTagResource(), rowId); } else if (triggerType == TriggerType.LONG_CLICK_LIST_ITEM) { view.setOnLongClickListener(this); view.setTag(tagIdDefinition.getRowPositionTagResource(), position); view.setTag(tagIdDefinition.getRowIdTagResource(), rowId); } }
Source:
<code>public void releaseCopier(Copier<?> copier) throws Exception { <START> if (!(copier instanceof IdentityCopier) & !(copier instanceof SerializingCopier)) { <END> releaseInstance(copier); } }</code><technical_language>I follow 100% thought path. check if _explicitly_ configure IdentityCopier a SerializingCopier? I pretty leak references leaving in ClassInstanceProvider instantiated set</technical_language>

Target:
public void releaseCopier(Copier<?> copier) throws Exception { if (!(copier instanceof SerializingCopier)) { releaseInstance(copier); } }
Source:
<code>private boolean possiblyPause(Set<Integer> assignment) throws InterruptedException { pauseLock.lockInterruptibly(); try { if (ioConfig.getPauseAfterRead() && assignment.isEmpty()) { pauseMillis = 0; pauseRequested = true; } if (pauseRequested) { log.info(pauseMillis == 0 ? "Pausing ingestion until resumed" : "Pausing ingestion for %d ms", pauseMillis); paused = true; shouldPause.signalAll(); while (pauseRequested) { if (pauseMillis == 0) { shouldResume.await(); <START> } else if (!shouldResume.await(pauseMillis, TimeUnit.MILLISECONDS)) { <END> pauseRequested = false; } } paused = false; shouldResume.signalAll(); log.info("Ingestion loop resumed"); return true; } } finally { pauseLock.unlock(); } return false; }</code><technical_language>await return early, check for await if needed. awaitNanos this a bit easier returns number of nanos left wait</technical_language>

Target:
private boolean possiblyPause(Set<Integer> assignment) throws InterruptedException { pauseLock.lockInterruptibly(); try { if (ioConfig.isPauseAfterRead() && assignment.isEmpty()) { pauseMillis = PAUSE_FOREVER; pauseRequested = true; } if (pauseRequested) { status = Status.PAUSED; long nanos = 0; hasPaused.signalAll(); while (pauseRequested) { if (pauseMillis == PAUSE_FOREVER) { log.info("Pausing ingestion until resumed"); shouldResume.await(); } else { if (pauseMillis > 0) { log.info("Pausing ingestion for [%,d] ms", pauseMillis); nanos = TimeUnit.MILLISECONDS.toNanos(pauseMillis); pauseMillis = 0; } if (nanos <= 0L) { pauseRequested = false; } nanos = shouldResume.awaitNanos(nanos); } } status = Status.READING; shouldResume.signalAll(); log.info("Ingestion loop resumed"); return true; } } finally { pauseLock.unlock(); } return false; }
Source:
<code>public FileSourceSplit updateWithCheckpointedPosition(@Nullable CheckpointedPosition position) { try { <START> return new HiveSourceSplit(toMapRedSplit(), hiveTablePartition, position); <END> } catch (IOException e) { throw new FlinkHiveException("Failed to update checkpoint position for split:" + toString(), e); } }</code><technical_language>toMapRedSplit, call another constructor</technical_language>

Target:
public FileSourceSplit updateWithCheckpointedPosition(@Nullable CheckpointedPosition position) { return new HiveSourceSplit(splitId(), path(), offset(), length(), hostnames(), position, hiveTablePartition); }
Source:
<code>private void processScanResponse(ClientResponse response) { setState(State.WAITING); if (response.getStatus() != ClientResponse.SUCCESS) { logFailureResponse("Initial snapshot scan failed", response); return; } final VoltTable results[] = response.getResults(); if (results.length == 1) { final VoltTable result = results[0]; boolean advanced = result.advanceRow(); assert(advanced); assert(result.getColumnCount() == 1); assert(result.getColumnType(0) == VoltType.STRING); SNAP_LOG.warn("Initial snapshot scan failed with failure response: " + result.getString("ERR_MSG")); return; } assert(results.length == 3); final VoltTable snapshots = results[0]; assert(snapshots.getColumnCount() == 9); final File myPath = new File(m_path); while (snapshots.advanceRow()) { final String path = snapshots.getString("PATH"); final File pathFile = new File(path); if (pathFile.equals(myPath)) { final String nonce = snapshots.getString("NONCE"); if (nonce.startsWith(m_prefixAndSeparator)) { final Long txnId = snapshots.getLong("TXNID"); <START> m_snapshots.add(new Snapshot(path, SnapthotPathType.SNAP_AUTO, nonce, txnId)); <END> } } } java.util.Collections.sort(m_snapshots); deleteExtraSnapshots(); }</code><technical_language>this bit scan for command log snapshots too</technical_language>

Target:
private void processScanResponse(ClientResponse response) { setState(State.WAITING); if (response.getStatus() != ClientResponse.SUCCESS) { logFailureResponse("Initial snapshot scan failed", response); return; } final VoltTable results[] = response.getResults(); if (results.length == 1) { final VoltTable result = results[0]; boolean advanced = result.advanceRow(); assert(advanced); assert(result.getColumnCount() == 1); assert(result.getColumnType(0) == VoltType.STRING); SNAP_LOG.warn("Initial snapshot scan failed with failure response: " + result.getString("ERR_MSG")); return; } assert(results.length == 3); final VoltTable snapshots = results[0]; assert(snapshots.getColumnCount() == 10); final File myPath = new File(m_path); while (snapshots.advanceRow()) { final String path = snapshots.getString("PATH"); final File pathFile = new File(path); if (pathFile.equals(myPath)) { final String nonce = snapshots.getString("NONCE"); if (nonce.startsWith(m_prefixAndSeparator)) { final Long txnId = snapshots.getLong("TXNID"); m_snapshots.add(new Snapshot(path, SnapshotPathType.SNAP_AUTO, nonce, txnId)); } } } java.util.Collections.sort(m_snapshots); deleteExtraSnapshots(); }
Source:
<code>private void serialize(String nodeName, Node node, JsonGenerator generator) { requireNonNull(node); BaseNodeMetaModel nodeMetaModel = JavaParserMetaModel.getNodeMetaModel(node.getClass()).orElseThrow(() -> new IllegalStateException("Unknown Node: " + node.getClass())); if (nodeName == null) { generator.writeStartObject(); } else { generator.writeStartObject(nodeName); } <START> generator.write("!", node.getClass().getName()); <END> for (PropertyMetaModel propertyMetaModel : nodeMetaModel.getAllPropertyMetaModels()) { String name = propertyMetaModel.getName(); Object value = propertyMetaModel.getValue(node); if (value != null) { if (propertyMetaModel.isNodeList()) { NodeList<Node> list = (NodeList<Node>) value; generator.writeStartArray(name); for (Node n : list) { serialize(null, n, generator); } generator.writeEnd(); } else if (propertyMetaModel.isEnumSet()) { EnumSet<? extends Enum> set = (EnumSet<? extends Enum>) value; generator.writeStartArray(name); for (Enum n : set) { generator.write(n.name()); } generator.writeEnd(); } else if (propertyMetaModel.isNode()) { serialize(name, (Node) value, generator); } else { generator.write(name, value.toString()); } } } generator.writeEnd(); }</code><technical_language>a constant for give a set this name in some sort of configuration</technical_language>

Target:
private void serialize(String nodeName, Node node, JsonGenerator generator) { requireNonNull(node); BaseNodeMetaModel nodeMetaModel = JavaParserMetaModel.getNodeMetaModel(node.getClass()).orElseThrow(() -> new IllegalStateException("Unknown Node: " + node.getClass())); if (nodeName == null) { generator.writeStartObject(); } else { generator.writeStartObject(nodeName); } generator.write(SERIALIZED_CLASS_KEY, node.getClass().getName()); for (PropertyMetaModel propertyMetaModel : nodeMetaModel.getAllPropertyMetaModels()) { String name = propertyMetaModel.getName(); Object value = propertyMetaModel.getValue(node); if (value != null) { if (propertyMetaModel.isNodeList()) { NodeList<Node> list = (NodeList<Node>) value; generator.writeStartArray(name); for (Node n : list) { serialize(null, n, generator); } generator.writeEnd(); } else if (propertyMetaModel.isEnumSet()) { EnumSet<? extends Enum> set = (EnumSet<? extends Enum>) value; generator.writeStartArray(name); for (Enum n : set) { generator.write(n.name()); } generator.writeEnd(); } else if (propertyMetaModel.isNode()) { serialize(name, (Node) value, generator); } else { generator.write(name, value.toString()); } } } generator.writeEnd(); }
Source:
<code>protected boolean replay(Exception e) { ExceptionRecorder<Result> exresult = exceptions.findByException(e); if (exresult == null) { return false; } reportException(e); <START> logger.debug("handling exception {}", e); <END> exresult.replay(result); return true; }</code><technical_language>do logger.debug("handling exception {}", e.getClass(), e);, print stacktrace "Handling exception BazingaException"</technical_language>

Target:
protected boolean replay(Exception e) { ExceptionRecorder<Result> exresult = exceptions.findByException(e); if (exresult == null) { return false; } reportException(e); logger.debug("handling exception {}", e.getClass(), e); exresult.replay(result); return true; }
Source:
<code>public static Sensor activeProcessRatioSensor(final String threadId, final String taskId, final StreamsMetricsImpl streamsMetrics) { final String name = ACTIVE_TASK_PREFIX + PROCESS + RATIO_SUFFIX; final Sensor sensor = streamsMetrics.taskLevelSensor(threadId, taskId, name, Sensor.RecordingLevel.INFO); <START> sensor.add( new MetricName( name, TASK_LEVEL_GROUP, PROCESS_RATIO_DESCRIPTION, streamsMetrics.taskLevelTagMap(threadId, taskId)), new Value() ); <END> return sensor; }</code><technical_language>suggestion addValueMetricToSensor( sensor, TASK_LEVEL_GROUP, streamsMetrics.taskLevelTagMap(threadId, taskId), name, PROCESS_RATIO_DESCRIPTION ); req: Please StreamsMetricsImpl#addValueMetricToSensor()</technical_language>

Target:
public static Sensor activeProcessRatioSensor(final String threadId, final String taskId, final StreamsMetricsImpl streamsMetrics) { final String name = ACTIVE_TASK_PREFIX + PROCESS + RATIO_SUFFIX; final Sensor sensor = streamsMetrics.taskLevelSensor(threadId, taskId, name, Sensor.RecordingLevel.INFO); addValueMetricToSensor( sensor, TASK_LEVEL_GROUP, streamsMetrics.taskLevelTagMap(threadId, taskId), name, PROCESS_RATIO_DESCRIPTION ); return sensor; }
Source:
<code>public String render(String template, String port) { if (!this.initialized) { init(); this.initialized = true; } ST stringTemplate = new ST(template); globalPropertiesMap.forEach((key, value) -> stringTemplate.add(key, <START> "isDevMachine".equals(key) ? <END> Boolean.parseBoolean(value) : value)); stringTemplate.add("serverName", portsToRefName.get(port)); return stringTemplate.render(); }</code><technical_language>"isDevMachine" a class constant</technical_language>

Target:
public String render(String template, String port) { if (!this.initialized) { init(); this.initialized = true; } ST stringTemplate = new ST(template); globalPropertiesMap.forEach((key, value) -> stringTemplate.add(key, IS_DEV_MACHINE_MACRO.equals(key) ? Boolean.parseBoolean(value) : value)); stringTemplate.add("serverName", portsToRefName.get(port)); return stringTemplate.render(); }
Source:
<code>protected ConsumerRecords<?, ?> consumerPoll(long pollInterval) { if (_enablePartitionAssignment) { <START> if (!_consumerAssignment.isEmpty()) { <END> return _consumer.poll(pollInterval); } else { return ConsumerRecords.EMPTY; } } else { return _consumer.poll(pollInterval); } }</code><technical_language>matter if assignment is empty? poll empty assignment? If matters, this ithe code simpler: if (_enablePartitionAssignment && _consumerAssignment.isEmpty()) { return ConsumerRecords.EMPTY; } else { return _consumer.poll(pollInterval); }</technical_language>

Target:
protected ConsumerRecords<?, ?> consumerPoll(long pollInterval) { if (_enablePartitionAssignment && _consumerAssignment.isEmpty()) { return ConsumerRecords.EMPTY; } else { return _consumer.poll(pollInterval); } }
Source:
<code>public void setup() { ModalFooterOKCancelButtons footer = createModalFooterOKCancelButtons(); footer.enableCancelButton(true); footer.enableOkButton(true); setBody(externalComponentEditor.asWidget()); add(footer); <START> setTitle("Component Editor"); <END> setWidth(1200 + "px"); }</code><technical_language>Consider i18n instead of hardcoding string Component Editor</technical_language>

Target:
public void setup() { ModalFooterOKCancelButtons footer = createModalFooterOKCancelButtons(); footer.enableCancelButton(true); footer.enableOkButton(true); setBody(externalComponentEditor.asWidget()); add(footer); setTitle(i18n.componentEditor()); setWidth(1200 + "px"); }
Source:
<code>public void EditHub_001_dashboardSelectVertical(String hubDBName) { WikiBasePageObject base = new WikiBasePageObject(driver); <START> base.logInCookie(credentials.userName, credentials.password, wikiURL); <END> SpecialEditHubPageObject pageObject = base.openSpecialEditHub(urlBuilder.getUrlForWiki(hubDBName)); pageObject.verifyCalendarAppears(); }</code><technical_language>this test is passing need pass Staff user ! ! ! :)</technical_language>

Target:
public void EditHub_001_dashboardSelectVertical(String hubDBName) { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userNameStaff, credentials.passwordStaff, wikiURL); SpecialEditHubPageObject pageObject = base.openSpecialEditHub(urlBuilder.getUrlForWiki(hubDBName)); pageObject.verifyCalendarAppears(); }
Source:
<code>public void processEvent(CloudTrailEvent event) { List<String> instanceIds = getInstanceIds(event); for(String id : instanceIds) { Map userData = getUserData(event, id); String source = (String)userData.get(SOURCE); if (source == null) { violationSink.put(new ViolationBuilder(format("InstanceID: %s is missing 'source' property in userData.", id)) .withEventId(getCloudTrailEventId(event)) .withRegion(getCloudTrailEventRegion(event)) .withAccountId(getCloudTrailEventAccountId(event)) .build()); } else if (source.matches(SNAPSHOT_REGEX)) { violationSink.put(new ViolationBuilder(format("InstanceID: %s was started with a mutable SNAPSHOT image.", id)).withEventId(getCloudTrailEventId(event)) .withRegion(getCloudTrailEventRegion(event)) .withAccountId(getCloudTrailEventAccountId(event)) .build()); } <START> }throw new UnsupportedOperationException("Not supported yet."); END> }</code><technical_language>;) forgot some autogeneration thing</technical_language>

Target:
public void processEvent(CloudTrailEvent event) { List<String> instanceIds = getInstanceIds(event); for (String id : instanceIds) { Map userData = null; try { userData = userDataProvider.getUserData(event, id); } catch (AmazonServiceException e) { LOG.error(e.getMessage()); violationSink.put(new ViolationBuilder(format("InstanceId: %s doesn't have any userData.", id)) .withEventId(getCloudTrailEventId(event)).withRegion(getCloudTrailEventRegion(event)) .withAccountId(getCloudTrailEventAccountId(event)).build()); return; } if (userData == null) { violationSink.put(new ViolationBuilder(format("InstanceId: %s doesn't have any userData.", id)) .withEventId(getCloudTrailEventId(event)).withRegion(getCloudTrailEventRegion(event)) .withAccountId(getCloudTrailEventAccountId(event)).build()); } String source = (String) userData.get(SOURCE); if (source == null) { violationSink.put(new ViolationBuilder(format( "InstanceID: %s is missing 'source' property in userData.", id)) .withEventId(getCloudTrailEventId(event)).withRegion(getCloudTrailEventRegion(event)) .withAccountId(getCloudTrailEventAccountId(event)).build()); } else if (source.matches(SNAPSHOT_REGEX)) { violationSink.put(new ViolationBuilder(format( "InstanceID: %s was started with a mutable SNAPSHOT image.", id)) .withEventId(getCloudTrailEventId(event)).withRegion(getCloudTrailEventRegion(event)) .withAccountId(getCloudTrailEventAccountId(event)).build()); } } }