auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException { serverAPIUrl = formData.getString("serverAPIUrl"); username = formData.getString("username"); password = formData.getString("password"); accessToken = formData.getString("accessToken"); adminlist = formData.getString("adminlist"); allowMembersOfWhitelistedOrgsAsAdmin = formData.has("allowMembersOfWhitelistedOrgsAsAdmin") ? formData.getBoolean("allowMembersOfWhitelistedOrgsAsAdmin") : false; publishedURL = formData.getString("publishedURL"); requestForTestingPhrase = formData.getString("requestForTestingPhrase"); whitelistPhrase = formData.getString("whitelistPhrase"); okToTestPhrase = formData.getString("okToTestPhrase"); retestPhrase = formData.getString("retestPhrase"); cron = formData.getString("cron"); useComments = formData.getBoolean("useComments"); logExcerptLines = formData.getInt("logExcerptLines"); unstableAs = formData.getString("unstableAs"); autoCloseFailedPullRequests = formData.getBoolean("autoCloseFailedPullRequests"); msgSuccess = formData.getString("msgSuccess"); msgFailure = formData.getString("msgFailure"); save(); gh = new GhprbGitHub(); return super.configure(req, formData); }

Target:
public boolean configure(StaplerRequest req, JSONObject formData) throws FormException { serverAPIUrl = formData.getString("serverAPIUrl"); username = formData.getString("username"); password = formData.getString("password"); accessToken = formData.getString("accessToken"); adminlist = formData.getString("adminlist"); publishedURL = formData.getString("publishedURL"); requestForTestingPhrase = formData.getString("requestForTestingPhrase"); whitelistPhrase = formData.getString("whitelistPhrase"); okToTestPhrase = formData.getString("okToTestPhrase"); retestPhrase = formData.getString("retestPhrase"); skipBuildPhrase = formData.getString("skipBuildPhrase"); cron = formData.getString("cron"); useComments = formData.getBoolean("useComments"); logExcerptLines = formData.getInt("logExcerptLines"); unstableAs = formData.getString("unstableAs"); autoCloseFailedPullRequests = formData.getBoolean("autoCloseFailedPullRequests"); msgSuccess = formData.getString("msgSuccess"); msgFailure = formData.getString("msgFailure"); save(); gh = new GhprbGitHub(); return super.configure(req, formData); }
Source:
public void testEncode(){ if (System.getProperty("os.name").contains("Windows")){ String testPath = "\\foo\\bar\\ham\r"; String expectedEncoded = "\\foo\\bar\\ham%0D"; String actualEncoded = PathUtils.encodeFilename(testPath); assertEquals(expectedEncoded, actualEncoded); testPath = "\\foo\\bar\\ham\n"; expectedEncoded = "\\foo\\bar\\ham%0A"; actualEncoded = PathUtils.encodeFilename(testPath); assertEquals(expectedEncoded, actualEncoded); testPath = "\\foo\\bar\\ham\r\n"; expectedEncoded = "\\foo\\bar\\ham%0D%0A"; actualEncoded = PathUtils.encodeFilename(testPath); assertEquals(expectedEncoded, actualEncoded); } else { Path testPath = Paths.get("/foo/bar/ham\r"); String expectedEncoded = "/foo/bar/ham%0D"; String actualEncoded = PathUtils.encodeFilename(testPath); assertEquals(expectedEncoded, actualEncoded); testPath = Paths.get("/foo/bar/ham\n"); expectedEncoded = "/foo/bar/ham%0A"; actualEncoded = PathUtils.encodeFilename(testPath); assertEquals(expectedEncoded, actualEncoded); testPath = Paths.get("/foo/bar/ham\r\n"); expectedEncoded = "/foo/bar/ham%0D%0A"; actualEncoded = PathUtils.encodeFilename(testPath); assertEquals(expectedEncoded, actualEncoded); } }

Target:
public void testEncode(){ String actualEncoded; Path testPath; String fileSeparator = FileSystems.getDefault().getSeparator(); StringBuilder sb = new StringBuilder(fileSeparator); String basePathString = sb.append("foo").append(fileSeparator).append("bar"). append(fileSeparator).append("ham").toString(); String testPathString = basePathString.concat("\r"); String expectedEncoded = basePathString.concat("%0D"); if (PathUtils.isWindows()){ actualEncoded = PathUtils.encodeFilenameString(testPathString); } else { testPath = Paths.get(testPathString); actualEncoded = PathUtils.encodeFilename(testPath); } assertEquals(expectedEncoded, actualEncoded); testPathString = basePathString.concat("\n"); expectedEncoded = basePathString.concat("%0A"); if (PathUtils.isWindows()){ actualEncoded = PathUtils.encodeFilenameString(testPathString); } else { testPath = Paths.get(testPathString); actualEncoded = PathUtils.encodeFilename(testPath); } assertEquals(expectedEncoded, actualEncoded); testPathString = basePathString.concat("\r\n"); expectedEncoded = basePathString.concat("%0D%0A"); if (PathUtils.isWindows()){ actualEncoded = PathUtils.encodeFilenameString(testPathString); } else { testPath = Paths.get(testPathString); actualEncoded = PathUtils.encodeFilename(testPath); } assertEquals(expectedEncoded, actualEncoded); }
Source:
private void logCommand(ReplicableCommand command, long requestId, String targets) { if (requestId != Request.NO_REQUEST_ID) { log.tracef("Sending request %d@%s to %s: %s", requestId, address, targets, command); } else { log.tracef("Sending command from %s to %s: %s", address, targets, command); } }

Target:
private void logCommand(ReplicableCommand command, long requestId, String targets) { if (requestId != Request.NO_REQUEST_ID) { log.tracef("%s sending request %d to %s: %s", address, requestId, targets, command); } else { log.tracef("%s sending command to %s: %s", address, targets, command); } }
Source:
protected void execute() { if (this.logger.isDebugEnabled()) { this.logger.debug("refreshing status"); } queryStatus(); }

Target:
protected void execute() { this.logger.debug("refreshing status"); queryStatus(); }
Source:
public void flipPhase(long yieldTimeNsec) { if (!readerLock.isHeldByCurrentThread()) { throw new IllegalStateException("flipPhase() can only be called while holding the readerLock()"); } boolean nextPhaseIsEven = (startEpoch.get(0) < 0); long initialStartValue; if (nextPhaseIsEven) { initialStartValue = 0; for (int i=0; i<stripes; i++) { evenEndEpoch.lazySet(i, initialStartValue + i * stride); } } else { initialStartValue = Long.MIN_VALUE; for (int i=0; i<stripes; i++) { oddEndEpoch.lazySet(i, initialStartValue + i * stride); } } final long[] startValueAtFlip = new long[stripes]; for (int i=0; i<stripes; i++) { startValueAtFlip[i] = startEpoch.getAndSet(i, initialStartValue + i * stride); } for (;;) { if (!caughtUp(startValueAtFlip, nextPhaseIsEven ? oddEndEpoch : evenEndEpoch)) { if (yieldTimeNsec == 0) { Thread.yield(); } else { try { TimeUnit.NANOSECONDS.sleep(yieldTimeNsec); } catch (InterruptedException ex) { } } } else { break; } } }

Target:
public void flipPhase(long yieldTimeNsec) { if (!readerLock.isHeldByCurrentThread()) { throw new IllegalStateException("flipPhase() can only be called while holding the readerLock()"); } boolean nextPhaseIsEven = (startEpoch.get(0) < 0); long initialStartValue; if (nextPhaseIsEven) { initialStartValue = 0; for (int i = 0; i < stripes; i++) { evenEndEpoch.lazySet(i * STRIDE, initialStartValue); } } else { initialStartValue = Long.MIN_VALUE; for (int i = 0; i < stripes; i++) { oddEndEpoch.lazySet(i * STRIDE, initialStartValue); } } final long[] startValueAtFlip = new long[stripes]; for (int i = 0; i < stripes; i++) { startValueAtFlip[i] = startEpoch.getAndSet(i * STRIDE, initialStartValue); } while (!caughtUp(startValueAtFlip, nextPhaseIsEven ? oddEndEpoch : evenEndEpoch)) { if (yieldTimeNsec == 0) { Thread.yield(); } else { try { TimeUnit.NANOSECONDS.sleep(yieldTimeNsec); } catch (InterruptedException ex) { } } } }
Source:
private void wipe(long thresholdMillis, Boolean saveResultsToDB) { long currentTimeMillis = System.currentTimeMillis(); LOGGER.info(getDatabaseName() + " Postgres wiper, checking for records older than ms", thresholdMillis); List<String> oldRecords = findOldRecords(currentTimeMillis, thresholdMillis); if (oldRecords.size() > 0) { if (!saveResultsToDB) { for (String recordId : oldRecords) { if (recordId.toLowerCase().contains("output")) { deleteFileOnDisk(recordId); } } } LOGGER.info("Cleaned records from database", deleteRecords(oldRecords)); } }

Target:
private void wipe(long thresholdMillis, Boolean saveResultsToDB) { long currentTimeMillis = System.currentTimeMillis(); LOGGER.info(getDatabaseName() + " Postgres wiper, checking for records older than ms", thresholdMillis); List<String> oldRecords = findOldRecords(currentTimeMillis, thresholdMillis); if (oldRecords.size() > 0) { if (!saveResultsToDB) { for (String recordId : oldRecords) { if (recordId.toLowerCase().contains("output")) { deleteFileOnDisk(recordId); } } } Integer recordsDeleted = deleteRecords(oldRecords); LOGGER.info("Cleaned records from database", recordsDeleted); } }
Source:
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { double rowCount = mq.getRowCount(this); switch (joinType) { case SEMI: case ANTI: break; case RIGHT: rowCount = RelMdUtil.addEpsilon(rowCount); break; default: if (RelNodes.COMPARATOR.compare(left, right) > 0) { rowCount = RelMdUtil.addEpsilon(rowCount); } } RelOptCostFactory costFactory = planner.getCostFactory(); final double rightRowCount = right.estimateRowCount(mq); final double leftRowCount = left.estimateRowCount(mq); if (Double.isInfinite(leftRowCount) || Double.isInfinite(rightRowCount)) { return costFactory.makeInfiniteCost(); } if (isSemiJoin()) { rowCount += rightRowCount * 1.1d; return costFactory.makeCost(rowCount, 0, 0).multiplyBy(.01d); } else { rowCount += leftRowCount * 1.1d; return costFactory.makeCost(rowCount, 0, 0); } }

Target:
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { double rowCount = mq.getRowCount(this); switch (joinType) { case SEMI: case ANTI: break; case RIGHT: rowCount = RelMdUtil.addEpsilon(rowCount); break; default: if (RelNodes.COMPARATOR.compare(left, right) > 0) { rowCount = RelMdUtil.addEpsilon(rowCount); } } final double rightRowCount = right.estimateRowCount(mq); final double leftRowCount = left.estimateRowCount(mq); if (Double.isInfinite(leftRowCount)) { rowCount = leftRowCount; } else { rowCount += Util.nLogN(leftRowCount); } if (Double.isInfinite(rightRowCount)) { rowCount = rightRowCount; } else { rowCount += rightRowCount; } if (isSemiJoin()) { return planner.getCostFactory().makeCost(rowCount, 0, 0).multiplyBy(.01d); } else { return planner.getCostFactory().makeCost(rowCount, 0, 0); } }
Source:
public Date getPasswordExpiresOn() { return mPasswordExpiresOn != null ? (Date) mPasswordExpiresOn.clone() : null; }

Target:
public Date getPasswordExpiresOn() { return Utility.getImmutableDateObject(mPasswordExpiresOn); }
Source:
public void onEvent(final CacheEvent<? extends String, ? extends Ticket> event) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Event Type: {}, Ticket Id: {}", event.getType().name(), event.getKey()); } }

Target:
public void onEvent(final CacheEvent<? extends String, ? extends Ticket> event) { LOGGER.trace("Event Type: {}, Ticket Id: {}", event.getType().name(), event.getKey()); }
Source:
private String getApplicationFilename() { String name = project.getBuild().getFinalName(); if (stripVersion) { int versionBeginIndex = project.getBuild().getFinalName().lastIndexOf("-" + project.getVersion()); if ( versionBeginIndex != -1) { name = project.getBuild().getFinalName().substring(0, versionBeginIndex); } } switch (project.getPackaging()) { case "ear": case "war": case "eba": case "esa": name += "." + project.getPackaging(); if (looseConfig) { name += ".xml"; } break; case "liberty-assembly": File dir = new File(project.getBasedir() + "/src/main/webapp"); if (dir.exists()) { name += ".war"; if (looseConfig) { name += ".xml"; } } break; default: log.debug("The project artifact can't be installed to Liberty server because " + project.getPackaging() + " is not one of the supported types"); name = null; break; } return name; }

Target:
private String getApplicationFilename() { String name = project.getBuild().getFinalName(); if (stripVersion) { int versionBeginIndex = project.getBuild().getFinalName().lastIndexOf("-" + project.getVersion()); if ( versionBeginIndex != -1) { name = project.getBuild().getFinalName().substring(0, versionBeginIndex); } } switch (project.getPackaging()) { case "ear": case "war": case "eba": case "esa": name += "." + project.getPackaging(); if (looseApplication) { name += ".xml"; } break; case "liberty-assembly": File dir = new File(project.getBasedir() + "/src/main/webapp"); if (dir.exists()) { name += ".war"; if (looseApplication) { name += ".xml"; } } break; default: log.debug("The project artifact cannot be installed to a Liberty server because " + project.getPackaging() + " is not a supported packaging type."); name = null; break; } return name; }
Source:
boolean isLocal() { return isFromWire(); }

Target:
protected boolean isLocal() { return !isFromWire(); }
Source:
public void validate(String mrrtTemplate) throws IOException { final Document document = Jsoup.parse(mrrtTemplate, ""); final Elements metatags = document.getElementsByTag("meta"); ValidationResult validationResult = metaTagsValidationEngine.run(metatags); final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); final Schema schema; final Validator validator; try (InputStream in = IOUtils.toInputStream(mrrtTemplate)) { schema = factory.newSchema(getSchemaFile()); validator = schema.newValidator(); validator.setErrorHandler(new ErrorHandler() { @Override public void warning(SAXParseException exception) throws SAXException { log.warn(exception.getMessage(), exception); validationResult.addError(cleanErrorMessage(exception), ""); } @Override public void error(SAXParseException exception) throws SAXException { log.error(exception.getMessage(), exception); validationResult.addError(cleanErrorMessage(exception), ""); } @Override public void fatalError(SAXParseException exception) throws SAXException { log.fatal(exception.getMessage(), exception); validationResult.addError(cleanErrorMessage(exception), ""); } }); validator.validate(new StreamSource(in)); validationResult.assertOk(); } catch (SAXException e) { log.error(e.getMessage(), e); throw new APIException("radiology.report.template.validation.error", null, e); } }

Target:
public void validate(String mrrtTemplate) throws IOException { final Document document = Jsoup.parse(mrrtTemplate, ""); final Elements metatags = document.getElementsByTag("meta"); ValidationResult validationResult = metaTagsValidationEngine.run(metatags); final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); final Schema schema; final Validator validator; try (InputStream in = IOUtils.toInputStream(mrrtTemplate)) { schema = factory.newSchema(getSchemaFile()); validator = schema.newValidator(); validator.setErrorHandler(new ErrorHandler() { @Override public void warning(SAXParseException exception) throws SAXException { log.debug(exception.getMessage(), exception); validationResult.addError(cleanErrorMessage(exception), ""); } @Override public void error(SAXParseException exception) throws SAXException { log.debug(exception.getMessage(), exception); validationResult.addError(cleanErrorMessage(exception), ""); } @Override public void fatalError(SAXParseException exception) throws SAXException { log.debug(exception.getMessage(), exception); validationResult.addError(cleanErrorMessage(exception), ""); } }); validator.validate(new StreamSource(in)); validationResult.assertOk(); } catch (SAXException e) { log.error(e.getMessage(), e); throw new APIException("radiology.report.template.validation.error", null, e); } }
Source:
public void testStatementWithNamedParam() throws Exception { OutParameters ret = h.createCall(":x = CALL TO_DEGREES(:y)") .registerOutParameter("x", Types.DOUBLE) .bind("y", 100.0d) .invoke(); Double expected = Math.toDegrees(100.0d); assertThat(ret.getDouble("x")).isEqualTo(expected, Offset.offset(0.001)); assertThat(ret.getLong("x").longValue()).isEqualTo(expected.longValue()); assertThat(ret.getShort("x").shortValue()).isEqualTo(expected.shortValue()); assertThat(ret.getInt("x").intValue()).isEqualTo(expected.intValue()); assertThat(ret.getFloat("x")).isEqualTo(expected.floatValue()); try { ret.getDate("x"); fail("didn't throw exception !"); } catch (Exception e) { } try { ret.getDate("y"); fail("didn't throw exception !"); } catch (Exception e) { assertThat(true).isTrue(); } }

Target:
public void testStatementWithNamedParam() throws Exception { OutParameters ret = h.createCall(":x = CALL TO_DEGREES(:y)") .registerOutParameter("x", Types.DOUBLE) .bind("y", 100.0d) .invoke(); Double expected = Math.toDegrees(100.0d); assertThat(ret.getDouble("x")).isEqualTo(expected, Offset.offset(0.001)); assertThat(ret.getLong("x").longValue()).isEqualTo(expected.longValue()); assertThat(ret.getShort("x").shortValue()).isEqualTo(expected.shortValue()); assertThat(ret.getInt("x").intValue()).isEqualTo(expected.intValue()); assertThat(ret.getFloat("x")).isEqualTo(expected.floatValue()); assertThatExceptionOfType(Exception.class).isThrownBy(()->{ ret.getDate("x"); }); assertThatExceptionOfType(Exception.class).isThrownBy(()->{ ret.getDate("y"); }); }
Source:
private static IncludedStructuralElement computeIfAbsent(IncludedStructuralElement includedStructuralElement, SimpleMetadataViewInterface simpleMetadataView, String value) { int index = 0; FOR_LOOP: for (IncludedStructuralElement child : includedStructuralElement.getChildren()) { String firstSimpleMetadataValue = MetadataEditor.readSimpleMetadataValues(child, simpleMetadataView).get(0); switch (Integer.signum(firstSimpleMetadataValue.compareTo(value))) { case -1: index++; break; case 0: return child; case 1: break FOR_LOOP; default: throw new IllegalStateException("complete switch"); } } IncludedStructuralElement computed = new IncludedStructuralElement(); MetadataEditor.writeMetadataEntry(computed, simpleMetadataView, value); includedStructuralElement.getChildren().add(index, computed); return computed; }

Target:
private static IncludedStructuralElement computeIfAbsent(IncludedStructuralElement includedStructuralElement, SimpleMetadataViewInterface simpleMetadataView, String value) { int index = 0; for (IncludedStructuralElement child : includedStructuralElement.getChildren()) { String firstSimpleMetadataValue = MetadataEditor.readSimpleMetadataValues(child, simpleMetadataView).get(0); int comparison = firstSimpleMetadataValue.compareTo(value); if (comparison <= -1) { index++; } else if (comparison == 0) { return child; } else { break; } } IncludedStructuralElement computed = new IncludedStructuralElement(); MetadataEditor.writeMetadataEntry(computed, simpleMetadataView, value); includedStructuralElement.getChildren().add(index, computed); return computed; }
Source:
public com.mojang.authlib.GameProfile getByNameNoLookup(String username) { @Nullable IMixinPlayerProfileCacheEntry entry = this.usernameToProfileEntryMap.get(username.toLowerCase(Locale.ROOT)); if (entry != null && new Date().getTime() >= entry.getExpirationDate().getTime()) { com.mojang.authlib.GameProfile profile = entry.getGameProfile(); this.uuidToProfileEntryMap.remove(profile.getId()); this.usernameToProfileEntryMap.remove(profile.getName().toLowerCase(Locale.ROOT)); this.gameProfiles.remove(profile); entry = null; } if (entry != null) { com.mojang.authlib.GameProfile profile = entry.getGameProfile(); this.gameProfiles.remove(profile); this.gameProfiles.addFirst(profile); } this.save(); return entry == null ? null : entry.getGameProfile(); }

Target:
public com.mojang.authlib.GameProfile getByNameNoLookup(String username) { @Nullable IMixinPlayerProfileCacheEntry entry = this.usernameToProfileEntryMap.get(username.toLowerCase(Locale.ROOT)); if (entry != null && System.currentTimeMillis() >= entry.getExpirationDate().getTime()) { com.mojang.authlib.GameProfile profile = entry.getGameProfile(); this.uuidToProfileEntryMap.remove(profile.getId()); this.usernameToProfileEntryMap.remove(profile.getName().toLowerCase(Locale.ROOT)); this.gameProfiles.remove(profile); entry = null; } if (entry != null) { com.mojang.authlib.GameProfile profile = entry.getGameProfile(); this.gameProfiles.remove(profile); this.gameProfiles.addFirst(profile); } this.save(); return entry == null ? null : entry.getGameProfile(); }
Source:
public void testConvertJsonToCSV() { String csvStr = "[/key][\"value\"]"; String jsonStr = "{\"key\":\"value\"}"; AsyncQuery queryObj = new AsyncQuery(); ElideResponse response = new ElideResponse(200, "ResponseBody"); String query = "/group?sort=commonName&fields%5Bgroup%5D=commonName,description"; String id = "edc4a871-dff2-4054-804e-d80075cf827d"; queryObj.setId(id); queryObj.setQuery(query); queryObj.setQueryType(QueryType.JSONAPI_V1_0); when(elide.get(anyString(), any(), any(), anyString())).thenReturn(response); AsyncQueryThread queryThread = new AsyncQueryThread(queryObj, user, elide, runner, asyncQueryDao, "v1", resultStorageEngine); String jsonToCSV = queryThread.convertJsonToCSV(jsonStr); assertEquals(jsonToCSV, csvStr); }

Target:
public void testConvertJsonToCSV() throws Exception { String csvStr = "key\n\"value\"\n"; String jsonStr = "{\"key\":\"value\"}"; AsyncQuery queryObj = new AsyncQuery(); AsyncQueryThread queryThread = new AsyncQueryThread(queryObj, user, elide, runner, asyncQueryDao, "v1", resultStorageEngine, BASE_URL_ENDPOINT); assertEquals(queryThread.convertJsonToCSV(jsonStr), csvStr); }
Source:
public void define(WebService.NewController context) { WebService.NewAction action = context.createAction(ACTION) .setPost(false) .setDescription("Search for organizations") .setResponseExample(getClass().getResource("search-example.json")) .setInternal(true) .setSince("6.2") .setChangelog(new Change("6.4", "Paging has been added to the response")) .setHandler(this); action.createParam(PARAM_ORGANIZATIONS) .setDescription("Comma-separated list of organization keys") .setExampleValue(String.join(",", "my-org-1", "foocorp")) .setRequired(false) .setSince("6.3"); action.addPagingParams(25); }

Target:
public void define(WebService.NewController context) { WebService.NewAction action = context.createAction(ACTION) .setPost(false) .setDescription("Search for organizations") .setResponseExample(getClass().getResource("search-example.json")) .setInternal(true) .setSince("6.2") .setChangelog(new Change("6.4", "Paging fields have been added to the response")) .setHandler(this); action.createParam(PARAM_ORGANIZATIONS) .setDescription("Comma-separated list of organization keys") .setExampleValue(String.join(",", "my-org-1", "foocorp")) .setRequired(false) .setSince("6.3"); action.addPagingParams(25); }
Source:
public JSONObject serialize() { JSONObject data = new JSONObject(); try { if (this.id != null) { data.put("_id", this.getId()); } if (this.version != -1) { data.put("_version", this.version); } data.put("body", this.getContent()); this.kuzzle.addHeaders(data, getHeaders()); } catch (JSONException e) { e.printStackTrace(); } return data; }

Target:
public JSONObject serialize() { JSONObject data = new JSONObject(); try { if (this.id != null) { data.put("_id", this.getId()); } if (this.version != -1) { data.put("_version", this.version); } data.put("body", this.getContent()); this.kuzzle.addHeaders(data, getHeaders()); } catch (JSONException e) { throw new RuntimeException(e); } return data; }
Source:
public Command buildDeleteTableElement(final DTableElement element) { Command cmd = UnexecutableCommand.INSTANCE; if (element instanceof DLine || element instanceof DTargetColumn) { if (!getPermissionAuthority().canEditInstance(element)) { cmd = new InvalidPermissionCommand(domain, element); } else { if (!getPermissionAuthority().canEditInstance(element.eContainer())) { cmd = new InvalidPermissionCommand(domain, element.eContainer()); } else { final SiriusCommand result = new SiriusCommand(domain); DeleteTool deleteTool = getDeleteTool(element); if (deleteTool != null) { addDeleteTableElementFromTool(result, element, deleteTool); addRefreshTask(TableHelper.getTable(element), result, deleteTool); cmd = new NoNullResourceCommand(result, element); } else { final Set<EObject> allSemanticElements = new HashSet<EObject>(); addSemanticElementsToDestroy(element, allSemanticElements); EObjectQuery eObjectQuery = new EObjectQuery(element); DRepresentation dRepresentation = eObjectQuery.getRepresentation().get(); final Set<DSemanticDecorator> tableElements = commandTaskHelper.getDElementToClearFromSemanticElements(dRepresentation, allSemanticElements); for (final DSemanticDecorator decorator : tableElements) { result.getTasks().add(new DeleteTableElementTask(decorator, modelAccessor)); } final Iterator<EObject> it = allSemanticElements.iterator(); while (it.hasNext()) { final EObject eObj = it.next(); result.getTasks().add(new DeleteTableElementTask(eObj, modelAccessor)); } addRefreshTask(TableHelper.getTable(element), result, deleteTool); cmd = new NoNullResourceCommand(result, element); } } } } return cmd; }

Target:
public Command buildDeleteTableElement(final DTableElement element) { Command cmd = UnexecutableCommand.INSTANCE; if (element instanceof DLine || element instanceof DTargetColumn) { if (!getPermissionAuthority().canEditInstance(element)) { cmd = new InvalidPermissionCommand(domain, element); } else { if (!getPermissionAuthority().canEditInstance(element.eContainer())) { cmd = new InvalidPermissionCommand(domain, element.eContainer()); } else { final SiriusCommand result = new SiriusCommand(domain); DeleteTool deleteTool = getDeleteTool(element); DTable parentTable = TableHelper.getTable(element); if (deleteTool != null) { addDeleteTableElementFromTool(result, element, deleteTool); addRefreshTask(parentTable, result, deleteTool); cmd = new NoNullResourceCommand(result, element); } else { final Set<EObject> allSemanticElements = new HashSet<EObject>(); addSemanticElementsToDestroy(element, allSemanticElements); if (parentTable != null) { final Set<DSemanticDecorator> tableElements = commandTaskHelper.getDElementToClearFromSemanticElements(parentTable, allSemanticElements); for (final DSemanticDecorator decorator : tableElements) { result.getTasks().add(new DeleteTableElementTask(decorator, modelAccessor)); } } final Iterator<EObject> it = allSemanticElements.iterator(); while (it.hasNext()) { final EObject eObj = it.next(); result.getTasks().add(new DeleteTableElementTask(eObj, modelAccessor)); } addRefreshTask(parentTable, result, deleteTool); cmd = new NoNullResourceCommand(result, element); } } } } return cmd; }
Source:
public void shouldSendPullRequestOnTick() throws Throwable { txPuller.start(); long lastAppliedTxId = 99L; when( txApplier.lastQueuedTxId() ).thenReturn( lastAppliedTxId ); timerService.invoke( TX_PULLER_TIMEOUT ); scheduler.runJob(); verify( catchUpClient ).makeBlockingRequest( any( MemberId.class ), any( TxPullRequest.class ), any( CatchUpResponseCallback.class ) ); }

Target:
public void shouldSendPullRequestOnTick() throws Throwable { txPuller.start(); long lastAppliedTxId = 99L; when( txApplier.lastQueuedTxId() ).thenReturn( lastAppliedTxId ); timerService.invoke( TX_PULLER_TIMER ); verify( catchUpClient ).makeBlockingRequest( any( MemberId.class ), any( TxPullRequest.class ), any( CatchUpResponseCallback.class ) ); }
Source:
public static HttpPipeline buildHttpPipeline( TokenCredential credential, AzureProfile profile, String[] scopes, HttpLogOptions httpLogOptions, Configuration configuration, RetryPolicy retryPolicy, List<HttpPipelinePolicy> additionalPolicies, HttpClient httpClient) { List<HttpPipelinePolicy> policies = new ArrayList<>(); policies.add(new UserAgentPolicy(httpLogOptions, configuration)); policies.add(new RequestIdPolicy()); policies.add(new ReturnRequestIdHeaderPolicy(ReturnRequestIdHeaderPolicy.Option.COPY_CLIENT_REQUEST_ID)); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); if (credential != null) { policies.add(new AuthenticationPolicy(credential, profile.getEnvironment(), scopes)); } if (additionalPolicies != null && !additionalPolicies.isEmpty()) { policies.addAll(additionalPolicies); } HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); return new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); }

Target:
public static HttpPipeline buildHttpPipeline( TokenCredential credential, AzureProfile profile, String[] scopes, HttpLogOptions httpLogOptions, Configuration configuration, RetryPolicy retryPolicy, List<HttpPipelinePolicy> additionalPolicies, HttpClient httpClient) { List<HttpPipelinePolicy> policies = new ArrayList<>(); policies.add(new UserAgentPolicy(httpLogOptions, configuration)); policies.add(new RequestIdPolicy()); policies.add(new ReturnRequestIdHeaderPolicy(ReturnRequestIdHeaderPolicy.Option.COPY_CLIENT_REQUEST_ID)); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); if (credential != null) { policies.add(new AuthenticationPolicy(credential, profile.getEnvironment(), scopes)); } policies.add(new ProviderRegistrationPolicy()); if (additionalPolicies != null && !additionalPolicies.isEmpty()) { policies.addAll(additionalPolicies); } HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); return new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); }
Source:
public void encode(Point geometry, AttributesImpl atts, GMLWriter handler, String gmlId) throws Exception { atts = cloneWithGmlId(atts, gmlId); handler.startElement(point, atts); handler.startElement(pos, null); Coordinate coordinate = geometry.getCoordinate(); handler.position(coordinate.x, coordinate.y, coordinate.z, coordinate.getM()); handler.endElement(pos); handler.endElement(point); }

Target:
public void encode(Point geometry, AttributesImpl atts, GMLWriter handler, String gmlId) throws Exception { atts = cloneWithGmlId(atts, gmlId); handler.startElement(point, atts); handler.startElement(pos, null); handler.position(geometry.getCoordinateSequence()); handler.endElement(pos); handler.endElement(point); }
Source:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { Cards cards = new CardsImpl(); Card card = controller.getLibrary().getFromTop(game); if (card != null) { cards.add(card); controller.revealCards(sourceObject.getIdName(), cards, game); if (card.isLand()) { game.addEffect(new BoostSourceEffect(1, 0, Duration.EndOfTurn), source); game.addEffect(new GainAbilitySourceEffect(new DealsDamageToACreatureTriggeredAbility(new DestroyTargetEffect(true), false, false, true), Duration.EndOfTurn), source); } } return true; } return false; }

Target:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { Cards cards = new CardsImpl(); Card card = controller.getLibrary().getFromTop(game); if (card != null) { cards.add(card); controller.revealCards(sourceObject.getIdName(), cards, game); if (card.isLand()) { game.addEffect(new GainAbilitySourceEffect(new DealsDamageToACreatureTriggeredAbility(new DestroyTargetEffect(true), false, false, true), Duration.EndOfTurn), source); } } return true; } return false; }
Source:
public static void registerCustomUnits(SimpleUnitFormat format) { format.label(Units.DEGREE_MINUTE_SECOND, "DMS"); format.alias(Units.DEGREE_MINUTE_SECOND, "degree minute second"); format.label(Units.SEXAGESIMAL_DMS, "D.MS"); format.alias(Units.SEXAGESIMAL_DMS, "sexagesimal DMS"); format.alias(Units.SEXAGESIMAL_DMS, "DDD.MMSSsss"); format.alias(Units.SEXAGESIMAL_DMS, "sexagesimal degree DDD.MMSSsss"); format.label(Units.PPM, "ppm"); }

Target:
static void registerCustomUnits(SimpleUnitFormat format) { format.label(Units.DEGREE_MINUTE_SECOND, "DMS"); format.alias(Units.DEGREE_MINUTE_SECOND, "degree minute second"); format.label(Units.SEXAGESIMAL_DMS, "D.MS"); format.alias(Units.SEXAGESIMAL_DMS, "sexagesimal DMS"); format.alias(Units.SEXAGESIMAL_DMS, "DDD.MMSSsss"); format.alias(Units.SEXAGESIMAL_DMS, "sexagesimal degree DDD.MMSSsss"); format.label(Units.PPM, "ppm"); format.label(NonSI.DEGREE_ANGLE, "°"); format.label(Units.PIXEL, "pixel"); format.label(USCustomary.GRADE, "grad"); format.alias(USCustomary.GRADE, "grade"); }
Source:
public void testIngressTimestamp() throws Exception { server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setEnableIngressTimestamp(true)); conn.connect(defUser, defPass); subscribe(conn, null, Stomp.Headers.Subscribe.AckModeValues.AUTO); sendJmsMessage(getName()); ClientStompFrame frame = conn.receiveFrame(10000); Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand()); Assert.assertEquals(getQueuePrefix() + getQueueName(), frame.getHeader(Stomp.Headers.Send.DESTINATION)); Assert.assertNotNull(frame.getHeader(Stomp.Headers.Message.INGRESS_TIMESTAMP)); Assert.assertEquals(getName(), frame.getBody()); conn.disconnect(); }

Target:
public void testIngressTimestamp() throws Exception { server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setEnableIngressTime(true)); conn.connect(defUser, defPass); subscribe(conn, null, Stomp.Headers.Subscribe.AckModeValues.AUTO); long before = System.currentTimeMillis(); sendJmsMessage(getName()); long after = System.currentTimeMillis(); ClientStompFrame frame = conn.receiveFrame(10000); Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand()); Assert.assertEquals(getQueuePrefix() + getQueueName(), frame.getHeader(Stomp.Headers.Send.DESTINATION)); String ingressTimeHeaderValue = frame.getHeader(Stomp.Headers.Message.INGRESS_TIME); Assert.assertNotNull(ingressTimeHeaderValue); long ingressTime = Long.parseLong(ingressTimeHeaderValue); assertTrue("Ingress time should be set in expected range", before <= ingressTime && after >= ingressTime); conn.disconnect(); }
Source:
public String getName() { return subscriptionName; }

Target:
public String getName() { return name; }
Source:
protected <T extends Variant> Set<T> getVariantsByType(PushApplication application, Class<T> type) { Set<T> variants = new HashSet<>(); application.getVariants().forEach(variant -> { if (variant.getClass().equals(type)) { variants.add((T) variant); } }); return variants; }

Target:
protected <T extends Variant> Set<T> getVariantsByType(PushApplication application, Class<T> type) { Objects.requireNonNull(type, "type"); return application.getVariants().stream() .filter(variant -> variant.getClass().equals(type)) .map(variant -> (T) variant) .collect(Collectors.toSet()); }
Source:
public List<Response> bulk(List<?> objects, boolean allOrNothing) { assertNotEmpty(objects, "objects"); InputStream responseStream = null; HttpConnection connection; try { final String allOrNothingVal = allOrNothing ? "\"all_or_nothing\": true, " : ""; final URI uri = buildUri(getDBUri()).path("_bulk_docs").build(); final String json = String.format("{%s%s%s}", allOrNothingVal, "\"docs\": ", getGson ().toJson(objects)); connection = couchDbClient.post(uri, json, HttpConnection.class); responseStream = connection.responseAsInputStream(); List<Response> bulkResponses = getResponseList(responseStream, getGson(), new TypeToken<List<Response>>() { }.getType()); for(Response response : bulkResponses) { response.setStatusCode(connection.getConnection().getResponseCode()); response.setReason(connection.getConnection().getResponseMessage()); } return bulkResponses; } catch (IOException e) { throw new CouchDbException("Error retrieving response input stream.", e); } finally { close(responseStream); } }

Target:
public List<Response> bulk(List<?> objects, boolean allOrNothing) { assertNotEmpty(objects, "objects"); InputStream responseStream = null; HttpConnection connection; try { final String allOrNothingVal = allOrNothing ? "\"all_or_nothing\": true, " : ""; final URI uri = buildUri(getDBUri()).path("_bulk_docs").build(); final String json = String.format("{%s%s%s}", allOrNothingVal, "\"docs\": ", getGson ().toJson(objects)); connection = Http.POST(uri, "application/json"); if (json != null && !json.isEmpty()) { connection.setRequestBody(json); } couchDbClient.execute(connection); responseStream = connection.responseAsInputStream(); List<Response> bulkResponses = getResponseList(responseStream, getGson(), new TypeToken<List<Response>>() { }.getType()); for(Response response : bulkResponses) { response.setStatusCode(connection.getConnection().getResponseCode()); response.setReason(connection.getConnection().getResponseMessage()); } return bulkResponses; } catch (IOException e) { throw new CouchDbException("Error retrieving response input stream.", e); } finally { close(responseStream); } }
Source:
protected void doReset() { allCommandsRetrieved = false; idToCommand = null; if (currentSnapshot instanceof ExpressionContext) { ((ExpressionContext) currentSnapshot).eclipseContext.dispose(); } currentSnapshot = null; }

Target:
protected void doReset() { allCommandsRetrieved = false; idToCommand.clear(); if (currentSnapshot instanceof ExpressionContext) { ((ExpressionContext) currentSnapshot).eclipseContext.dispose(); } currentSnapshot = null; }
Source:
public String getSQLiteVersion() { try { return this.submit(new SQLQueueCallable<String>() { @Override public String call(SQLDatabase db) throws Exception { Cursor cursor = db.rawQuery("SELECT sqlite_version() AS sqlite_version", null); String sqliteVersion = ""; while(cursor.moveToNext()){ sqliteVersion += cursor.getString(0); } return sqliteVersion; } }).get(); } catch (InterruptedException e) { logger.log(Level.WARNING, "Could not determine SQLite version", e); } catch (ExecutionException e) { logger.log(Level.WARNING, "Could not determine SQLite version", e); } return "unknown"; }

Target:
public synchronized String getSQLiteVersion() { if (this.sqliteVersion == null) { try { this.sqliteVersion = this.submit(new SQLQueueCallable<String>() { @Override public String call(SQLDatabase db) throws Exception { Cursor cursor = db.rawQuery("SELECT sqlite_version()", null); String sqliteVersion = ""; while (cursor.moveToNext()) { sqliteVersion += cursor.getString(0); } return sqliteVersion; } }).get(); return sqliteVersion; } catch (InterruptedException e) { logger.log(Level.WARNING, "Could not determine SQLite version", e); } catch (ExecutionException e) { logger.log(Level.WARNING, "Could not determine SQLite version", e); } this.sqliteVersion = "unknown"; } return this.sqliteVersion; }
Source:
public String toString() { String[] queryParams = toQueryParams(); Arrays.sort(queryParams); return String.join("&", queryParams); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); String[] queryParams = toQueryParams(); for (int a = 0;a<queryParams.length;a++) { sb.append(a < queryParams.length - 1 ? queryParams[a] + "&" : queryParams[a]); } return sb.toString(); }
Source:
public static void main(String[] args) throws ConfigurationException, Exception { options = new YarnAdminOptions(); JCommander jcommand = new JCommander(options, args); if (options.displayHelp()) { jcommand.usage(); System.exit(-1); } Logging.init("ClusterAdmin", options.getFluoConf(), "STDOUT", false); File configFile = new File(options.getFluoConf() + "/fluo.properties"); config = new FluoConfiguration(configFile); curator = CuratorUtil.getCurator(config); curator.start(); YarnConfiguration yarnConfig = new YarnConfiguration(); yarnConfig.addResource(new Path(options.getHadoopPrefix() + "/etc/hadoop/core-site.xml")); yarnConfig.addResource(new Path(options.getHadoopPrefix() + "/etc/hadoop/yarn-site.xml")); twillRunner = new YarnTwillRunnerService(yarnConfig, config.getZookeepers()+"/twill"); twillRunner.startAndWait(); Thread.sleep(1000); switch (options.getCommand().toLowerCase()) { case "start": start(); break; case "stop": stop(); break; case "kill": kill(); break; case "status": status(); break; default: log.error("Unknown command: " + options.getCommand()); break; } twillRunner.stop(); curator.close(); }

Target:
public static void main(String[] args) throws ConfigurationException, Exception { options = new YarnAdminOptions(); JCommander jcommand = new JCommander(options, args); if (options.displayHelp()) { jcommand.usage(); System.exit(-1); } Logging.init("ClusterAdmin", options.getFluoConf(), "STDOUT", false); File configFile = new File(options.getFluoConf() + "/fluo.properties"); config = new FluoConfiguration(configFile); try { curator = CuratorUtil.getCurator(config); curator.start(); YarnConfiguration yarnConfig = new YarnConfiguration(); yarnConfig.addResource(new Path(options.getHadoopPrefix() + "/etc/hadoop/core-site.xml")); yarnConfig.addResource(new Path(options.getHadoopPrefix() + "/etc/hadoop/yarn-site.xml")); try { twillRunner = new YarnTwillRunnerService(yarnConfig, config.getZookeepers() + ZookeeperConstants.TWILL); twillRunner.startAndWait(); Thread.sleep(1000); switch (options.getCommand().toLowerCase()) { case "start": start(); break; case "stop": stop(); break; case "kill": kill(); break; case "status": status(); break; default: log.error("Unknown command: " + options.getCommand()); break; } } finally { if (twillRunner != null) { twillRunner.stop(); } } } finally { if (curator != null) { curator.close(); } } }
Source:
public boolean awaitStart(long timeoutMs) throws InterruptedException { return containerController.awaitStart(timeoutMs); }

Target:
public boolean awaitStart(long timeoutMs) throws InterruptedException { return jobCoordinator.awaitStart(timeoutMs); }
Source:
void testLocalGameButton() { final ScreenController<FxmlManager> mock = mock(ScreenController.class); final GameSelectionControls aboutInformation = new GameSelectionControls(); aboutInformation.connect(mock); aboutInformation.showLocalGameMenu(); verify(mock).switchScreen(FxmlManager.MAP_SELECTION); }

Target:
void testLocalGameButton() { final ScreenController<FxmlManager> screenControllerMock = mock(ScreenController.class); final GameSelectionControls aboutInformation = new GameSelectionControls(); aboutInformation.connect(screenControllerMock); aboutInformation.showLocalGameMenu(); verify(screenControllerMock).switchScreen(FxmlManager.MAP_SELECTION); }
Source:
public void expandLineItemsDiscount() throws Exception { final RelativeCartDiscountValue relativeCartDiscountValue = RelativeCartDiscountValue.of(15000); withDiscountedLineItem(client(), relativeCartDiscountValue, (cart) -> { final CartQuery query = CartQuery.of() .withPredicates(m -> m.id().is(cart.getId())) .withExpansionPaths(m -> m.lineItems().discountedPricePerQuantity().discountedPrice().includedDiscounts().discount()); assertEventually(() -> { final Cart loadedCart = client().executeBlocking(query).head().get(); final Reference<CartDiscount> cartDiscountReference = loadedCart.getLineItems().get(0).getDiscountedPricePerQuantity().get(0).getDiscountedPrice().getIncludedDiscounts().get(0).getDiscount(); assertThat(cartDiscountReference.getObj()).isNotNull(); final CartDiscount lineItemDiscount = cartDiscountReference.getObj(); assertThat(lineItemDiscount).isNotNull(); final CartDiscountValue customLineItemDiscountValue = lineItemDiscount.getValue(); assertThat(customLineItemDiscountValue).isEqualTo(relativeCartDiscountValue); }); }); }

Target:
public void expandLineItemsDiscount() throws Exception { final RelativeCartDiscountValue relativeCartDiscountValue = RelativeCartDiscountValue.of(15000); withCartHavingCartDiscountedLineItem(client(), relativeCartDiscountValue, (cart) -> { final CartQuery query = CartQuery.of() .withPredicates(m -> m.id().is(cart.getId())) .withExpansionPaths(m -> m.lineItems().discountedPricePerQuantity().discountedPrice().includedDiscounts().discount()); final Cart loadedCart = client().executeBlocking(query).head().get(); final Reference<CartDiscount> cartDiscountReference = loadedCart.getLineItems().get(0).getDiscountedPricePerQuantity().get(0).getDiscountedPrice().getIncludedDiscounts().get(0).getDiscount(); assertThat(cartDiscountReference.getObj()).isNotNull(); final CartDiscount lineItemDiscount = cartDiscountReference.getObj(); final CartDiscountValue customLineItemDiscountValue = lineItemDiscount.getValue(); assertThat(customLineItemDiscountValue).isEqualTo(relativeCartDiscountValue); return loadedCart; }); }
Source:
public JobCoordinator getJobCoordinator(Config config) { MetricsRegistry metricsRegistry = new MetricsRegistryMap(); String jobCoordinatorZkBasePath = getJobCoordinationZkPath(config); ZkUtils zkUtils = getZkUtils(config, metricsRegistry, jobCoordinatorZkBasePath); MapConfig mapConfig = new MapConfig(config, ImmutableMap.of(ZkConfig.CONFIG_COORDINATOR_ZK_BASE_PATH, jobCoordinatorZkBasePath)); LOG.debug("Creating ZkJobCoordinator with config: {}.", mapConfig); return new ZkJobCoordinator(mapConfig, metricsRegistry, zkUtils); }

Target:
public JobCoordinator getJobCoordinator(Config config) { MetricsRegistry metricsRegistry = new MetricsRegistryMap(); String jobCoordinatorZkBasePath = getJobCoordinationZkPath(config); ZkUtils zkUtils = getZkUtils(config, metricsRegistry, jobCoordinatorZkBasePath); LOG.debug("Creating ZkJobCoordinator with config: {}.", config); return new ZkJobCoordinator(config, metricsRegistry, zkUtils); }
Source:
private void displayFormDeletedNotification(String id, String name) { final int notificationId = formId(id); String text = String.format("Form \"%s\" has been deleted", name); String title = "Form deleted"; NotificationHelper.displayNonOnGoingErrorNotification(this, notificationId, text, title); }

Target:
private void displayFormDeletedNotification(String id, String name) { final int notificationId = formId(id); String text = String.format(getString(R.string.data_sync_error_form_deleted_text), name); String title = getString(R.string.data_sync_error_form_deleted_title); NotificationHelper.displayNonOnGoingErrorNotification(this, notificationId, text, title); }
Source:
protected void scanFile(XmlFile file) { if (!"pom.xml".equals(file.getInputFile().filename())) { return; } try { Node groupId = (Node) groupIdExpression.evaluate(file.getNamespaceUnawareDocument(), XPathConstants.NODE); String content = groupId.getTextContent(); if (!getPattern().matcher(content).matches()) { reportIssue(groupId.getFirstChild(), "Update this \"groupId\" to match the provided regular expression: '" + regex + "'"); } } catch (NullPointerException e) { } catch (XPathExpressionException e) { throw new AnalysisException("Unable to evaluate XPath expression", e); } }

Target:
protected void scanFile(XmlFile file) { if (!"pom.xml".equalsIgnoreCase(file.getInputFile().filename())) { return; } NodeList groupIds = evaluate(groupIdExpression, file.getNamespaceUnawareDocument()); if (groupIds.getLength() != 1) { return; } Node groupId = groupIds.item(0); if (!getPattern().matcher(groupId.getTextContent()).matches()) { reportIssue(groupId, "Update this \"groupId\" to match the provided regular expression: '" + regex + "'"); } }
Source:
private BlackboardArtifact.Type getShellBagArtifact() throws TskCoreException { if (shellBagArtifactType == null) { try { shellBagArtifactType = tskCase.getBlackboard().getOrAddArtifactType(SHELLBAG_ARTIFACT_NAME, Bundle.Shellbag_Artifact_Display_Name()); } catch (BlackboardException ex) { String msg = String.format("Failed to get shell bag artifact type", SHELLBAG_ARTIFACT_NAME); logger.log(Level.SEVERE, msg, ex); throw new TskCoreException(msg, ex); } } return shellBagArtifactType; }

Target:
private BlackboardArtifact.Type getShellBagArtifact() throws TskCoreException { if (shellBagArtifactType == null) { try { shellBagArtifactType = tskCase.getBlackboard().getOrAddArtifactType(SHELLBAG_ARTIFACT_NAME, Bundle.Shellbag_Artifact_Display_Name()); } catch (BlackboardException ex) { throw new TskCoreException(String.format("Failed to get shell bag artifact type", SHELLBAG_ARTIFACT_NAME), ex); } } return shellBagArtifactType; }
Source:
public void getSentMessage_shouldGetMessageById() { SentMessage sm = sentMessageService.getSentMessage(11); Assert.assertNotNull(sm); Assert.assertEquals(11, (int)sm.getMessageId()); Assert.assertEquals(21, (int)sm.getSenderId()); Assert.assertEquals(31, (int)sm.getReceiverId()); }

Target:
public void getSentMessage_shouldGetMessageById() { SentMessage sm = sentMessageService.getSentMessage(11); Assert.assertNotNull(sm); Assert.assertEquals(11, (int)sm.getMessageId()); Assert.assertEquals(21, (int)sm.getSender().getUserId()); Assert.assertEquals(31, (int)sm.getReceiver().getUserId()); }