auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testRewritePOMs() throws Exception { URL resource = PomIOTest.class.getResource( filename ); assertNotNull( resource ); File pom = new File( resource.getFile() ); assertTrue( pom.exists() ); File targetFile = folder.newFile( "target.xml" ); FileUtils.writeStringToFile( targetFile, FileUtils.readFileToString( pom, Charset.defaultCharset() ).replaceAll( "dospom", "newdospom" ), Charset.defaultCharset() ); FileUtils.copyFile( pom, targetFile ); List<Project> projects = pomIO.parseProject( targetFile ); Model model = projects.get( 0 ).getModel(); model.setGroupId( "org.commonjava.maven.ext.versioning.test" ); model.setArtifactId( "dospom" ); model.setVersion( "1.0" ); model.setPackaging( "pom" ); model.setModelVersion( "4.0.0" ); Project p = new Project( targetFile, model ); HashSet<Project> changed = new HashSet<>(); changed.add( p ); pomIO.rewritePOMs( changed ); assertTrue( FileUtils.contentEqualsIgnoreEOL( pom, targetFile, StandardCharsets.UTF_8.toString() ) ); assertTrue( FileUtils.contentEquals( targetFile, pom ) ); }

Target:
public void testRewritePOMs() throws Exception { URL resource = PomIOTest.class.getResource( filename ); assertNotNull( resource ); File pom = new File( resource.getFile() ); assertTrue( pom.exists() ); File targetFile = folder.newFile( "target.xml" ); FileUtils.writeStringToFile( targetFile, FileUtils.readFileToString( pom, StandardCharsets.UTF_8 ) .replaceAll( "dospom", "newdospom" ), StandardCharsets.UTF_8 ); FileUtils.copyFile( pom, targetFile ); List<Project> projects = pomIO.parseProject( targetFile ); Model model = projects.get( 0 ).getModel(); model.setGroupId( "org.commonjava.maven.ext.versioning.test" ); model.setArtifactId( "dospom" ); model.setVersion( "1.0" ); model.setPackaging( "pom" ); model.setModelVersion( "4.0.0" ); Project p = new Project( targetFile, model ); HashSet<Project> changed = new HashSet<>(); changed.add( p ); pomIO.rewritePOMs( changed ); assertTrue( FileUtils.contentEqualsIgnoreEOL( pom, targetFile, StandardCharsets.UTF_8.toString() ) ); assertTrue( FileUtils.contentEquals( targetFile, pom ) ); }
Source:
public Authentication attemptAuthentication(HttpServletRequest req, HttpServletResponse res) throws AuthenticationException { String user = req.getParameter("user"); String password = req.getParameter("password"); try { return authenticationManager.authenticate( new DSpaceAuthentication( user, password, new ArrayList<>() ) ); } catch(BadCredentialsException e) { DSpace dspace = new DSpace(); ConfigurationService configurationService = dspace.getConfigurationService(); String[] authMethods = configurationService.getArrayProperty("plugin.sequence.org.dspace.authenticate.AuthenticationMethod", new String[0]); for(String method: authMethods) { if (method.equals("org.dspace.authenticate.ShibAuthentication")) { String shibLoginUrl = configurationService.getProperty("authentication-shibboleth.lazysession.loginurl", ""); if (!shibLoginUrl.isEmpty()) { res.addHeader("Location", String.format("https://%s%s?target=%s", req.getHeader("Host"), shibLoginUrl, req.getHeader("Referer"))); } break; } } throw e; } }

Target:
public Authentication attemptAuthentication(HttpServletRequest req, HttpServletResponse res) throws AuthenticationException { String user = req.getParameter("user"); String password = req.getParameter("password"); try { return authenticationManager.authenticate( new DSpaceAuthentication( user, password, new ArrayList<>() ) ); } catch(BadCredentialsException e) { AuthenticationService authenticationService = AuthenticateServiceFactory.getInstance().getAuthenticationService(); Iterator<AuthenticationMethod> authenticationMethodIterator = authenticationService.authenticationMethodIterator(); while (authenticationMethodIterator.hasNext()) { AuthenticationMethod authenticationMethod = authenticationMethodIterator.next(); Context context = ContextUtil.obtainContext(req); String loginPageURL = authenticationMethod.loginPageURL(context, req, res); if (StringUtils.isNotBlank(loginPageURL)) { res.addHeader("Location", loginPageURL); } } throw e; } }
Source:
public Location getByRef(String ref) { Matcher matcher = refPattern.matcher(ref); checkArgument(matcher.matches()); return get(Integer.parseInt(matcher.group(1))); }

Target:
public Location getByRef(String ref) { Matcher matcher = refPattern.matcher(ref); checkArgument(matcher.matches(), "URI '%s' does not match pattern '%s'", ref, refPattern); return get(Integer.parseInt(matcher.group(1))); }
Source:
private boolean isEmbeddedIn(String classOrEnumName) { FieldFrame currentFrame = this; boolean isEmbeddedIn = false; while (currentFrame != null) { if (Objects.equals(currentFrame.frameName, classOrEnumName)) { isEmbeddedIn = true; } currentFrame = currentFrame.parent; } return isEmbeddedIn; }

Target:
private boolean isEmbeddedIn(String classOrEnumName) { FieldFrame currentFrame = this; boolean isEmbeddedIn = false; while (currentFrame != null) { if (Objects.equals(currentFrame.frameName, classOrEnumName)) { isEmbeddedIn = true; break; } currentFrame = currentFrame.parent; } return isEmbeddedIn; }
Source:
private Artifact resolveArtifact(Artifact artifact) { final ArtifactResolutionResult result = request(artifact, remoteRepositories); if (!result.isSuccess()) { result.getExceptions().forEach(e -> { LOG.warn("Failed to resolve {}: {}", artifact.getId(), e.getMessage()); LOG.debug("Exceptions in artifact resolution.", e); }); } return artifact; }

Target:
private Artifact resolveArtifact(Artifact artifact) { final ArtifactResolutionResult result = request(artifact, remoteRepositories); if (!result.isSuccess()) { result.getExceptions().forEach(e -> LOG.warn("Failed to resolve {}: {}", artifact.getId(), e.getMessage())); } return artifact; }
Source:
public void testCreateDistroXWithEncryptedVolume(TestContext testContext) { String externalDB = resourcePropertyProvider().getName(); List<DistroXInstanceGroupTestDto> distroXInstanceGroupTestDtos = new DistroXInstanceGroupsBuilder(testContext) .defaultHostGroup() .withDiskEncryption() .build(); testContext.given(externalDB, DistroXExternalDatabaseTestDto.class) .withAvailabilityType(DistroXDatabaseAvailabilityType.NON_HA) .given(DistroXTestDto.class) .withInstanceGroupsEntity(distroXInstanceGroupTestDtos) .withExternalDatabase(externalDB) .when(distroXTestClient.create()) .await(STACK_AVAILABLE) .then(validateTemplateContainsExternalDatabaseHostname(Actor.defaultUser(testParameter))) .then((context, distrox, client) -> { distrox.getResponse(); return distrox; }) .validate(); }

Target:
public void testCreateDistroXWithEncryptedVolume(TestContext testContext) { String externalDatabaseName = resourcePropertyProvider().getName(); List<DistroXInstanceGroupTestDto> distroXInstanceGroupTestDtos = new DistroXInstanceGroupsBuilder(testContext) .defaultHostGroup() .withDiskEncryption() .build(); testContext.given(externalDatabaseName, DistroXExternalDatabaseTestDto.class) .withAvailabilityType(DistroXDatabaseAvailabilityType.NON_HA) .given(DistroXTestDto.class) .withInstanceGroupsEntity(distroXInstanceGroupTestDtos) .withExternalDatabase(externalDatabaseName) .when(distroXTestClient.create()) .await(STACK_AVAILABLE) .then(validateTemplateContainsExternalDatabaseHostname()) .then((context, distrox, client) -> { distrox.getResponse(); return distrox; }) .validate(); }
Source:
protected void saveElement(final EObject o, final EStructuralFeature f) { if (f.getContainerClass().equals(EMapPropertyHolder.class)) { if (o instanceof ElkPropertyToValueMapEntryImpl) { IProperty<?> property = ((ElkPropertyToValueMapEntryImpl) o).getKey(); LayoutOptionData optionData = LayoutMetaDataService.getInstance().getOptionData(property.getId()); if (optionData != null && !optionData.canParseValue()) { return; } } } super.saveElement(o, f); }

Target:
protected void saveElement(final EObject o, final EStructuralFeature f) { if (f.equals(ElkGraphPackage.Literals.EMAP_PROPERTY_HOLDER__PROPERTIES) && o instanceof ElkPropertyToValueMapEntryImpl) { IProperty<?> property = ((ElkPropertyToValueMapEntryImpl) o).getKey(); LayoutOptionData optionData = LayoutMetaDataService.getInstance().getOptionData(property.getId()); if (optionData != null && !optionData.canParseValue()) { return; } } super.saveElement(o, f); }
Source:
private synchronized void loadImpl(Properties props, File confFile) { ExtensionEntry entry = new ExtensionEntry(props, confFile); ExtensionEntry alreadyLoaded = loadedEntries.get(entry.getName()); if (alreadyLoaded != null) { throw new ConfigurationException(String.format("Could not load the configuration %1$s. %2$s", String.format("'%1$s' %2$s", entry.getName(), entry.file != null ? "from file " + entry.file.getAbsolutePath(): ""), alreadyLoaded.file != null ? String.format("The already loaded file %1$s contains a configuration with the same name", alreadyLoaded.file.getAbsolutePath()) : "")); } loadedEntries.put(entry.getName(), entry); activate(entry); }

Target:
private synchronized void loadImpl(Properties props, File confFile) { ExtensionEntry entry = new ExtensionEntry(props, confFile); ExtensionEntry alreadyLoadedEntry = loadedEntries.get(entry.getName()); if (alreadyLoadedEntry != null) { throw new ConfigurationException(String.format( "Could not load the configuration '%1$s' from file %2$s. A configuration with the same name was already loaded from file %3$s", entry.getName(), getFileName(entry.file), getFileName(alreadyLoadedEntry.file)) ); } loadedEntries.put(entry.getName(), entry); entry.enabled = EngineLocalConfig.getInstance().getBoolean(ENGINE_EXTENSION_ENABLED + entry.getName(), entry.enabled); if (entry.enabled && entry.extension == null) { try { entry.extension = (Extension) lookupService( Extension.class, entry.getConfig().getProperty(CLASS), entry.getConfig().getProperty(MODULE) ).newInstance(); entry.extension.setContext(entry.context); entry.extension.init(); activatedEntries.put(entry.getName(), entry); MultiValueMapUtils.addToMap(entry.getProvides(), entry, providesEntries); } catch (Exception ex) { entry.enabled = false; log.error( String.format( "Error in activating extension %1$s. Exception message is %2$s", entry.getName(), ex.getMessage() ) ); if (log.isDebugEnabled()) { log.error("", ex); } } } }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof CommentAnnotation)) { return false; } final CommentAnnotation other = (CommentAnnotation) obj; if (comment == null) { if (other.comment != null) { return false; } } else if (!comment.equals(other.comment)) { IUser author = comment.getAuthor(); IUser otherAuthor = other.comment.getAuthor(); if (author == null) { if (otherAuthor != null) { return false; } } else if (!author.getId().equals(otherAuthor.getId())) { return false; } Date creationDate = comment.getCreationDate(); Date otherCreationDate = other.comment.getCreationDate(); if (creationDate == null) { if (otherCreationDate != null) { return false; } } else if (creationDate.getTime() != otherCreationDate.getTime()) { return false; } String description = comment.getDescription(); String otherDescription = other.comment.getDescription(); if (description == null) { if (otherDescription != null) { return false; } } else if (!description.equals(otherDescription)) { return false; } } if (position == null) { if (other.position != null) { return false; } } else if (!position.equals(other.position)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } CommentAnnotation other = (CommentAnnotation) obj; if (position == null) { if (other.position != null) { return false; } } else if (!position.equals(other.position)) { return false; } if (commentEquality == null) { if (other.commentEquality != null) { return false; } } else if (!commentEquality.equals(other.commentEquality)) { return false; } return true; }
Source:
public void testCopyWhileAppend() throws Exception { deleteState(); mkdirs(SOURCE_PATH + "/1"); touchFile(SOURCE_PATH + "/1/3"); CopyMapper copyMapper = new CopyMapper(); StubContext stubContext = new StubContext(getConfiguration(), null, 0); Mapper<Text, CopyListingFileStatus, Text, Text>.Context context = stubContext.getContext(); copyMapper.setup(context); final Path path = new Path(SOURCE_PATH + "/1/3"); int manyBytes = 100000000; appendFile(path, manyBytes); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); Runnable task = new Runnable() { public void run() { try { int maxAppendAttempts = 20; int appendCount = 0; while (appendCount < maxAppendAttempts) { appendFile(path, 1000); Thread.sleep(200); appendCount++; } } catch (IOException | InterruptedException e) { e.printStackTrace(); } } }; scheduledExecutorService.schedule(task, 10, TimeUnit.MILLISECONDS); boolean isFileMismatchErrorPresent = false; try { copyMapper.map(new Text(DistCpUtils.getRelativePath(new Path(SOURCE_PATH), path)), new CopyListingFileStatus(cluster.getFileSystem().getFileStatus( path)), context); } catch (Exception ex) { StringWriter sw = new StringWriter(); ex.printStackTrace(new PrintWriter(sw)); String exceptionAsString = sw.toString(); if (exceptionAsString.contains("Mismatch in length of source") || exceptionAsString.contains("Checksum mismatch")) { isFileMismatchErrorPresent = true; } } Assert.assertFalse(isFileMismatchErrorPresent); scheduledExecutorService.shutdown(); }

Target:
public void testCopyWhileAppend() throws Exception { deleteState(); mkdirs(SOURCE_PATH + "/1"); touchFile(SOURCE_PATH + "/1/3"); CopyMapper copyMapper = new CopyMapper(); StubContext stubContext = new StubContext(getConfiguration(), null, 0); Mapper<Text, CopyListingFileStatus, Text, Text>.Context context = stubContext.getContext(); copyMapper.setup(context); final Path path = new Path(SOURCE_PATH + "/1/3"); int manyBytes = 100000000; appendFile(path, manyBytes); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); Runnable task = new Runnable() { public void run() { try { int maxAppendAttempts = 20; int appendCount = 0; while (appendCount < maxAppendAttempts) { appendFile(path, 1000); Thread.sleep(200); appendCount++; } } catch (IOException | InterruptedException e) { LOG.error("Exception encountered ", e); Assert.fail("Test failed: " + e.getMessage()); } } }; scheduledExecutorService.schedule(task, 10, TimeUnit.MILLISECONDS); try { copyMapper.map(new Text(DistCpUtils.getRelativePath( new Path(SOURCE_PATH), path)), new CopyListingFileStatus(cluster.getFileSystem().getFileStatus( path)), context); } catch (Exception ex) { StringWriter sw = new StringWriter(); ex.printStackTrace(new PrintWriter(sw)); String exceptionAsString = sw.toString(); LOG.error("Exception encountered ", ex); if (exceptionAsString.contains(DistCpConstants.LENGTH_MISMATCH_ERROR_MSG) || exceptionAsString.contains(DistCpConstants.CHECKSUM_MISMATCH_ERROR_MSG)) { Assert.fail("Test failed: " + exceptionAsString); } } finally { scheduledExecutorService.shutdown(); } }
Source:
private Leased<Set<LockToken>> filter(Set<LockToken> tokens, Predicate<HeldLocks> predicate) { Set<LockToken> filtered = Sets.newHashSetWithExpectedSize(tokens.size()); Optional<NanoTime> minStartTime = Optional.empty(); for (LockToken token : tokens) { AsyncResult<HeldLocks> lockResult = heldLocksById.get(token.getRequestId()); if (lockResult != null && lockResult.test(predicate)) { filtered.add(token); NanoTime lastRefreshTime = lockResult.get().lastRefreshTime(); minStartTime = minStartTime.map(t -> lastRefreshTime.isBefore(t) ? lastRefreshTime : t); } } return Leased.of(filtered, leaseWithStart(minStartTime.orElse(NanoTime.now()))); }

Target:
private Set<LockToken> filter(Set<LockToken> tokens, Predicate<HeldLocks> predicate) { Set<LockToken> filtered = Sets.newHashSetWithExpectedSize(tokens.size()); for (LockToken token : tokens) { AsyncResult<HeldLocks> lockResult = heldLocksById.get(token.getRequestId()); if (lockResult != null && lockResult.test(predicate)) { filtered.add(token); } } return filtered; }
Source:
public void testJoinedSubclassUpdateWithCorrelation() { doInJPA( this::entityManagerFactory, entityManager -> { Master m1 = new SubMaster( 1, null ); entityManager.persist( m1 ); Detail d11 = new Detail( 10, m1 ); entityManager.persist( d11 ); } ); doInJPA( this::entityManagerFactory, entityManager -> { String d = "update SubMaster m set name = (select 'test' from Detail d where d.master = m)"; Query del = entityManager.createQuery( d ); del.executeUpdate(); CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<Master> query = builder.createQuery( Master.class ); query.select( query.from( Master.class ) ); List<Master> masters = entityManager.createQuery( query ).getResultList(); Assert.assertEquals( 1, masters.size() ); Assert.assertEquals( "test", ((SubMaster) masters.get(0)).name ); } ); }

Target:
public void testJoinedSubclassUpdateWithCorrelation() { doInJPA( this::entityManagerFactory, entityManager -> { Master m1 = new SubMaster( 1, null ); entityManager.persist( m1 ); Detail d11 = new Detail( 10, m1 ); entityManager.persist( d11 ); } ); doInJPA( this::entityManagerFactory, entityManager -> { String u = "update SubMaster m set name = (select 'test' from Detail d where d.master = m)"; Query updateQuery = entityManager.createQuery( u ); updateQuery.executeUpdate(); CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<Master> query = builder.createQuery( Master.class ); query.select( query.from( Master.class ) ); List<Master> masters = entityManager.createQuery( query ).getResultList(); Assert.assertEquals( 1, masters.size() ); Assert.assertEquals( "test", ((SubMaster) masters.get(0)).name ); } ); }
Source:
public static void logMbps(final long startTime, final long endTime, final long totalBytes, final String objName, final boolean isPutCommand) { final double time = (endTime - startTime == 0)? 1.0: (endTime - startTime)/1000D; final double content = totalBytes/1024D/1024D; final double mbps = content / time; if (isPutCommand) { LOG.info(String.format("Putting %s statistics: Length (%.03f MB), Time (%.03f sec), Mbps (%.03f)", objName, content, time, mbps)); } else { LOG.info(String.format("Getting %s statistics: Length (%.03f MB), Time (%.03f sec), Mbps (%.03f)", objName, content, time, mbps)); } }

Target:
public static void logMbps(final long startTime, final long endTime, final long totalBytes, final String objName, final boolean isPutCommand) { final double time = (endTime - startTime == 0)? 1.0: (endTime - startTime)/1000D; final double content = totalBytes/1024D/1024D; final double mbps = content / time; final String messagePrefix; if (isPutCommand) { messagePrefix = "Putting"; } else { messagePrefix = "Getting"; } LOG.info(String.format("%s %s statistics: Length (%.03f MB), Time (%.03f sec), Mbps (%.03f)", messagePrefix, objName, content, time, mbps)); }
Source:
public Flux<ByteBuf> body() { return bodyAsByteArray().flatMapMany(bytes -> Flux.just(Unpooled.wrappedBuffer(bytes).retain())); }

Target:
public Flux<ByteBuf> body() { return bodyAsByteArray().flatMapMany(bytes -> Flux.just(Unpooled.wrappedBuffer(bytes))); }
Source:
public void test () throws Exception { final String pillId = "whateva"; final Integer firmwareVersion = 4; final byte[] encryptedMotionData = bytes(0x0F, 0xFB, 0x55, 0x0A, 0xC4, 0x2C, 0x53, 0x03, 0x59, 0x79, 0x0E, 0xC4, 0x5C, 0xD1, 0x43, 0x28, 0xA2, 0x87); final byte[] key = bytes(0xD4, 0xD9, 0xEC, 0x79, 0xC9, 0x24, 0xB6, 0xC1, 0x23, 0xA2, 0x82, 0x4F, 0x47, 0x8A, 0x5E, 0xCB); final SenseCommandProtos.pill_data pillData = SenseCommandProtos.pill_data.newBuilder() .setDeviceId(pillId) .setBatteryLevel(100) .setFirmwareVersion(firmwareVersion) .setMotionDataEntrypted(ByteString.copyFrom(encryptedMotionData)) .setTimestamp(1L) .build(); final TrackerMotion.PillPayloadV2 payloadV2 = TrackerMotion.data(pillData, key, pillId); assertThat(payloadV2.maxAcceleration, is((1072L-383L)*2)); assertThat(payloadV2.onDurationInSeconds, is(2L)); assertThat(payloadV2.motionMask.get(), is(3377699720527872L)); assertThat(payloadV2.cosTheta.get(), is(109L)); }

Target:
public void test () throws Exception { final String pillId = "whateva"; final Integer firmwareVersion = 4; final byte[] encryptedMotionData = bytes(0x0F, 0xFB, 0x55, 0x0A, 0xC4, 0x2C, 0x53, 0x03, 0x59, 0x79, 0x0E, 0xC4, 0x5C, 0xD1, 0x43, 0x28, 0xA2, 0x87); final byte[] key = bytes(0xD4, 0xD9, 0xEC, 0x79, 0xC9, 0x24, 0xB6, 0xC1, 0x23, 0xA2, 0x82, 0x4F, 0x47, 0x8A, 0x5E, 0xCB); final SenseCommandProtos.pill_data pillData = SenseCommandProtos.pill_data.newBuilder() .setDeviceId(pillId) .setBatteryLevel(100) .setFirmwareVersion(firmwareVersion) .setMotionDataEntrypted(ByteString.copyFrom(encryptedMotionData)) .setTimestamp(1L) .build(); final TrackerMotion.PillPayloadV2 payloadV2 = TrackerMotion.data(pillData, key, pillId); assertThat(payloadV2.maxAcceleration, is((1072L-PILL_1P5_OFFSET) * PILL_1P5_MOTION_MULTIPLIER)); assertThat(payloadV2.onDurationInSeconds, is(2L)); assertThat(payloadV2.motionMask.get(), is(3377699720527872L)); assertThat(payloadV2.cosTheta.get(), is(109L)); }
Source:
private String getDefaultSharedConfigLocation(ILaunchConfiguration config) { String path = IInternalDebugCoreConstants.EMPTY_STRING; try { IResource[] resourcea = config.getMappedResources(); if(resourcea != null) { IProject proj; for (IResource resource : resourcea) { proj = resource.getProject(); if(proj != null && proj.isAccessible()) { return proj.getFullPath().toOSString(); } } } } catch (CoreException e) {DebugUIPlugin.log(e);} return path; }

Target:
private String getDefaultSharedConfigLocation(ILaunchConfiguration config) { String path = IInternalDebugCoreConstants.EMPTY_STRING; try { IResource[] mappedResources = config.getMappedResources(); if(mappedResources != null) { IProject proj; for (IResource resource : mappedResources) { proj = resource.getProject(); if(proj != null && proj.isAccessible()) { return proj.getFullPath().toOSString(); } } } } catch (CoreException e) {DebugUIPlugin.log(e);} return path; }
Source:
private static boolean isValidRevision(String revision) { return revision.indexOf(':') < 0 && !revision.contains("^{") && revision.indexOf('@') < 0; }

Target:
private static boolean isValidRevision(String revision) { return !revision.contains(":") && !revision.contains("^{") && !revision.contains("@"); }
Source:
public DisksViewRadioGroup() { HorizontalPanel panel = new HorizontalPanel(); Label label = new Label(); label.setText(constants.diskType()); label.getElement().getStyle().setProperty("marginRight", "10px"); label.getElement().getStyle().setProperty("marginBottom", "4px"); panel.add(label); panel.add(getRadioGroupPanel()); initWidget(panel); }

Target:
public DisksViewRadioGroup() { FlowPanel panel = new FlowPanel(); Label label = new Label(); label.setText(constants.diskType() + ":"); label.addStyleName("disk-storage-type-group-label"); panel.add(label); panel.add(getRadioGroupPanel()); initWidget(panel); }
Source:
public boolean ipMatchesDomain(String forwardedAddress, String domain) { try { String ipAddress = extractForwardedIp(forwardedAddress); Optional<String> host = reverseDnsLookup.lookup(ipAddress); if (host.isEmpty()) { throw new Exception(format("Host not found for ip address '%s'", ipAddress)); } if (!host.get().endsWith(domain + ".")) { logger.error("Reverse DNS lookup on ip '{}' - resolved domain '{}' does not match '{}'", ipAddress, host.get(), domain); return false; } return true; } catch (Exception e) { logger.error("Reverse DNS Lookup failed: {}", e.getLocalizedMessage()); return false; } }

Target:
public boolean ipMatchesDomain(String forwardedAddress, String domain) { try { String ipAddress = extractForwardedIp(forwardedAddress); return reverseDnsLookup.lookup(new DnsPointerResourceRecord(ipAddress)).map(host -> { if (!host.endsWith(domain + ".")) { LOGGER.error("Reverse DNS lookup on ip '{}' - resolved domain '{}' does not match '{}'", ipAddress, host, domain); return false; } return true; }).orElseThrow(() -> new Exception(format("Host not found for ip address '%s'", ipAddress))); } catch (Exception e) { LOGGER.error("Reverse DNS Lookup failed: {}", e.getLocalizedMessage()); return false; } }
Source:
public void incrementValue(ITmfEvent event, int quark, long timestamp) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { ITmfStateSystemBuilder ss = fProvider.getAssignedStateSystem(); int increment = 0; ITmfStateValue incrementValue = getValue(event); if (incrementValue.getType() == ITmfStateValue.Type.INTEGER) { increment = incrementValue.unboxInt(); } else if (incrementValue.getType() == ITmfStateValue.Type.LONG) { increment = (int) incrementValue.unboxLong(); } else { Activator.logWarning("TmfXmlStateValue: The query result increment is not a number type"); } int currentValue = ss.queryOngoingState(quark).unboxInt(); ITmfStateValue value = TmfStateValue.newValueInt(increment + currentValue); processValue(quark, timestamp, value); }

Target:
public void incrementValue(ITmfEvent event, int quark, long timestamp) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { ITmfStateSystem ss = fProvider.getAssignedStateSystem(); ITmfStateValue incrementValue = getValue(event); switch (incrementValue.getType()) { case INTEGER: { int increment = incrementValue.unboxInt(); int currentValue = ss.queryOngoingState(quark).unboxInt(); ITmfStateValue value = TmfStateValue.newValueInt(increment + currentValue); processValue(quark, timestamp, value); break; } case LONG: { long incrementLong = incrementValue.unboxLong(); long currentValue = ss.queryOngoingState(quark).unboxLong(); ITmfStateValue value = TmfStateValue.newValueLong(incrementLong + currentValue); processValue(quark, timestamp, value); break; } case DOUBLE: case NULL: case STRING: default: Activator.logWarning("TmfXmlStateValue: The query result increment is not a number type"); break; } }
Source:
private int extractEntryCodePart(String lawJournalEntryCode, int partNumber) { try { return Integer.parseInt(StringUtils.split(lawJournalEntryCode, LawJournalEntry.ENTRY_CODE_PARTS_SEPARATOR)[partNumber]); } catch (NumberFormatException | IndexOutOfBoundsException e) { throw new IllegalArgumentException(lawJournalEntryCode + " is invalid law journal entry code"); } }

Target:
private int extractEntryCodePart(String lawJournalEntryCode, int partNumber) { return Integer.parseInt(StringUtils.split(lawJournalEntryCode, LawJournalEntry.ENTRY_CODE_PARTS_SEPARATOR)[partNumber]); }
Source:
public Map<Locator, MetricData> getDatapointsForRange( List<Locator> locators, Range range, Granularity gran ) throws IOException { Timer.Context ctx = Instrumentation.getReadTimerContext( "DBasicMetricsRW.getDatapointsForRange" ); try { List<Locator> unknowns = new ArrayList<Locator>(); List<Locator> strings = new ArrayList<Locator>(); List<Locator> booleans = new ArrayList<Locator>(); List<Locator> numerics = new ArrayList<Locator>(); for ( Locator locator : locators ) { Object type; try { type = metadataCache.get( locator, DATA_TYPE_CACHE_KEY ); } catch ( CacheException e ) { LOG.error( "Unable to read cache", e ); unknowns.add( locator ); continue; } DataType metricType = new DataType( (String) type ); if ( type == null || !DataType.isKnownMetricType( metricType ) ) { unknowns.add( locator ); continue; } else if ( metricType.equals( DataType.STRING ) ) { strings.add( locator ); continue; } else if ( metricType.equals( DataType.BOOLEAN ) ) { booleans.add( locator ); continue; } else { numerics.add( locator ); } } Map<Locator, MetricData> metrics = new HashMap<Locator, MetricData>(); String columnFamily = CassandraModel.getBasicColumnFamilyName( gran ); metrics.putAll( super.getDatapointsForRange( numerics, range, columnFamily, gran ) ); metrics.putAll( getBooleanDataForRange( booleans, range ) ); metrics.putAll( getStringDataForRange( strings, range ) ); metrics.putAll( getNumericOrStringDataForRange( unknowns, range, columnFamily, gran ) ); return metrics; } finally { ctx.stop(); } }

Target:
public Map<Locator, MetricData> getDatapointsForRange( List<Locator> locators, Range range, Granularity gran ) throws IOException { List<Locator> unknowns = new ArrayList<Locator>(); List<Locator> strings = new ArrayList<Locator>(); List<Locator> booleans = new ArrayList<Locator>(); List<Locator> numerics = new ArrayList<Locator>(); for ( Locator locator : locators ) { Object type; try { type = metadataCache.get( locator, DATA_TYPE_CACHE_KEY ); } catch ( CacheException e ) { LOG.error(String.format("Error looking up locator %s in cache", locator), e); unknowns.add( locator ); continue; } DataType metricType = new DataType( (String) type ); if ( type == null || !DataType.isKnownMetricType( metricType ) ) { unknowns.add( locator ); continue; } else if ( metricType.equals( DataType.STRING ) ) { strings.add( locator ); continue; } else if ( metricType.equals( DataType.BOOLEAN ) ) { booleans.add( locator ); continue; } else { numerics.add( locator ); } } Map<Locator, MetricData> metrics = new HashMap<Locator, MetricData>(); String columnFamily = CassandraModel.getBasicColumnFamilyName( gran ); metrics.putAll( super.getDatapointsForRange( locators, range, columnFamily, gran ) ); metrics.putAll( getBooleanDataForRange( booleans, range ) ); metrics.putAll( getStringDataForRange( strings, range ) ); metrics.putAll( getNumericOrStringDataForRange( unknowns, range, columnFamily, gran ) ); return metrics; }
Source:
public AccountId channelSignIn(ChannelType channelType, CriteriaContext context, SignIn signIn, Validator validator) { Validate.entityThrowingException(validator, signIn); String cacheKey = (channelType == ChannelType.EMAIL) ? getPhoneSignInCacheKey(signIn.getPhone(), signIn.getStudyId()) : getEmailSignInCacheKey(signIn.getEmail(), signIn.getStudyId()); String storedToken = cacheProvider.getObject(cacheKey, String.class); if (storedToken == null || !storedToken.equals(signIn.getToken())) { throw new AuthenticationFailedException(); } cacheProvider.removeObject(cacheKey); return signIn.getAccountId(); }

Target:
public AccountId channelSignIn(ChannelType channelType, CriteriaContext context, SignIn signIn, Validator validator) { Validate.entityThrowingException(validator, signIn); String cacheKey = (channelType == ChannelType.EMAIL) ? getEmailSignInCacheKey(signIn.getEmail(), signIn.getStudyId()) : getPhoneSignInCacheKey(signIn.getPhone(), signIn.getStudyId()); String storedToken = cacheProvider.getObject(cacheKey, String.class); if (storedToken == null || !storedToken.equals(signIn.getToken())) { throw new AuthenticationFailedException(); } cacheProvider.removeObject(cacheKey); return signIn.getAccountId(); }
Source:
private void verifyPersonConsumer(ConsumerDTO consumer, ConsumerType type, Owner owner, String username, Principal principal) { UserInfo user = null; try { user = userService.findByLogin(username); } catch (UnsupportedOperationException e) { log.warn("User service does not allow user lookups, cannot verify person consumer."); } if (user == null) { throw new NotFoundException(i18n.tr(this.i18n.tr("User not found: {0}", username))); } if (!principal.canAccess(owner, SubResource.NONE, Access.ALL) && !principal.hasFullAccess()) { throw new ForbiddenException(i18n.tr("User \"{0}\" has no roles for organization \"{1}\"", user.getUsername(), owner.getKey())); } if (type.isType(ConsumerTypeEnum.PERSON)) { Consumer existing = consumerCurator.findByUsername(user.getUsername()); if (existing != null && this.consumerTypeCurator.getConsumerType(existing).isType(ConsumerTypeEnum.PERSON)) { throw new BadRequestException( i18n.tr("User \"{0}\" has already registered a personal consumer", user.getUsername())); } consumer.setName(user.getUsername()); } }

Target:
private void verifyPersonConsumer(ConsumerDTO consumer, ConsumerType type, Owner owner, String username, Principal principal) { UserInfo user = null; try { user = userService.findByLogin(username); } catch (UnsupportedOperationException e) { log.warn("User service does not allow user lookups, cannot verify person consumer."); } if (user == null) { throw new NotFoundException(this.i18n.tr("User not found: {0}", username)); } if (!principal.canAccess(owner, SubResource.NONE, Access.ALL) && !principal.hasFullAccess()) { throw new ForbiddenException(i18n.tr("User \"{0}\" has no roles for organization \"{1}\"", user.getUsername(), owner.getKey())); } if (type.isType(ConsumerTypeEnum.PERSON)) { Consumer existing = consumerCurator.findByUsername(user.getUsername()); if (existing != null && this.consumerTypeCurator.getConsumerType(existing).isType(ConsumerTypeEnum.PERSON)) { throw new BadRequestException( i18n.tr("User \"{0}\" has already registered a personal consumer", user.getUsername())); } consumer.setName(user.getUsername()); } }
Source:
private static Integer getRunTimeForAllTests( Map<String, List<WrappedReportEntry>> methodRunHistoryMap ) { Integer totalTimeForSuite = 0; for ( Map.Entry<String, List<WrappedReportEntry>> entry : methodRunHistoryMap.entrySet() ) { List<WrappedReportEntry> methodEntryList = entry.getValue(); if ( methodEntryList == null ) { throw new IllegalStateException( "Get null test method run history" ); } if ( methodEntryList.size() == 0 ) { continue; } TestResultType resultType = getTestResultType( methodEntryList ); switch ( resultType ) { case success: case error: case failure: totalTimeForSuite = totalTimeForSuite + methodEntryList.get( 0 ).getElapsed(); break; case flake: for ( WrappedReportEntry singleRunEntry : methodEntryList ) { if ( singleRunEntry.getReportEntryType() == ReportEntryType.success ) { totalTimeForSuite = totalTimeForSuite + singleRunEntry.getElapsed(); break; } } break; case skipped: break; default: throw new IllegalStateException( "Get unknown test result type" ); } } return totalTimeForSuite; }

Target:
private static int getRunTimeForAllTests( Map<String, List<WrappedReportEntry>> methodRunHistoryMap ) { int totalTimeForSuite = 0; for ( Map.Entry<String, List<WrappedReportEntry>> entry : methodRunHistoryMap.entrySet() ) { List<WrappedReportEntry> methodEntryList = entry.getValue(); if ( methodEntryList == null ) { throw new IllegalStateException( "Get null test method run history" ); } if ( methodEntryList.size() == 0 ) { continue; } TestResultType resultType = getTestResultType( methodEntryList ); switch ( resultType ) { case success: case error: case failure: totalTimeForSuite = totalTimeForSuite + methodEntryList.get( 0 ).getElapsed(); break; case flake: for ( WrappedReportEntry singleRunEntry : methodEntryList ) { if ( singleRunEntry.getReportEntryType() == ReportEntryType.success ) { totalTimeForSuite = totalTimeForSuite + singleRunEntry.getElapsed(); break; } } break; case skipped: break; default: throw new IllegalStateException( "Get unknown test result type" ); } } return totalTimeForSuite; }
Source:
public void shouldGetOrderGroupByUuid() throws Exception { MockHttpServletRequest post_req = newPostRequest(getURI(), json); SimpleObject result = deserialize(handle(post_req)); String uuid = (String) PropertyUtils.getProperty(result, "uuid"); MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/"+uuid); SimpleObject response = deserialize(handle(req)); Assert.assertEquals(patient_uuid, Util.getByPath(response, "patient/uuid")); Assert.assertEquals(encounter_uuid,Util.getByPath(response, "encounter/uuid")); Assert.assertEquals(orderSet_uuid,Util.getByPath(response, "orderSet/uuid")); Assert.assertEquals(display, Util.getByPath(response, "display")); }

Target:
public void shouldGetOrderGroupByUuid() throws Exception { OrderGroup orderGroup = Context.getOrderService().getOrderGroupByUuid(RestTestConstants1_12.ORDER_GROUP_UUID); Patient patient = orderGroup.getPatient(); Encounter encounter = orderGroup.getEncounter(); OrderSet orderSet = orderGroup.getOrderSet(); Order order = Context.getOrderService().getOrder(1); Order order2 = Context.getOrderService().getOrder(3); List<Order> orders = new ArrayList<Order>(); orders.add(order); orders.add(order2); orderGroup.setOrders(orders); order.setOrderGroup(orderGroup); order2.setOrderGroup(orderGroup); MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/" + RestTestConstants1_12.ORDER_GROUP_UUID); SimpleObject response = deserialize(handle(req)); Assert.assertEquals(patient.getUuid(), Util.getByPath(response, "patient/uuid")); Assert.assertEquals(encounter.getUuid(), Util.getByPath(response, "encounter/uuid")); Assert.assertEquals(orderSet.getUuid(), Util.getByPath(response, "orderSet/uuid")); Assert.assertEquals(RestTestConstants1_12.ORDER_GROUP_DISPLAY, Util.getByPath(response, "display")); List<Order> orderList = (List<Order>) PropertyUtils.getProperty(response, "orders"); Assert.assertEquals(2, orderList.size()); }
Source:
public boolean isRecommendationEnabled(String tenantDomain) { if (recommendationEnvironment != null) { if (recommendationEnvironment.isApplyForAllTenants()) { return true; } else { JSONObject apiTenantConfig = null; try { String content = apimRegistryService .getConfigRegistryResourceContent(tenantDomain, APIConstants.API_TENANT_CONF_LOCATION); if (content != null) { JSONParser parser = new JSONParser(); apiTenantConfig = (JSONObject) parser.parse(content); } return getTenantConfigValue(tenantDomain, apiTenantConfig, APIConstants.API_TENANT_CONF_ENABLE_RECOMMENDATION_KEY); } catch (UserStoreException e) { log.error("UserStoreException thrown when getting API tenant config from registry", e); } catch (RegistryException e) { log.error("RegistryException thrown when getting API tenant config from registry", e); } catch (ParseException e) { log.error("ParseException thrown when passing API tenant config from registry", e); } catch (APIManagementException e) { log.debug(e.getMessage()); } } } return false; }

Target:
public boolean isRecommendationEnabled(String tenantDomain) { if (recommendationEnvironment != null) { if (recommendationEnvironment.isApplyForAllTenants()) { return true; } else { try { org.json.JSONObject tenantConfig = null; Cache tenantConfigCache = APIUtil.getCache( APIConstants.API_MANAGER_CACHE_MANAGER, APIConstants.TENANT_CONFIG_CACHE_NAME, APIConstants.TENANT_CONFIG_CACHE_MODIFIED_EXPIRY, APIConstants.TENANT_CONFIG_CACHE_ACCESS_EXPIRY); String cacheName = tenantDomain + "_" + APIConstants.TENANT_CONFIG_CACHE_NAME; if (tenantConfigCache.containsKey(cacheName)) { tenantConfig = (org.json.JSONObject) tenantConfigCache.get(cacheName); } else { String content = apimRegistryService .getConfigRegistryResourceContent(tenantDomain, APIConstants.API_TENANT_CONF_LOCATION); tenantConfig = new org.json.JSONObject(content); tenantConfigCache.put(cacheName, tenantConfig); } if (tenantConfig.has(APIConstants.API_TENANT_CONF_ENABLE_RECOMMENDATION_KEY)) { Object value = tenantConfig.get(APIConstants.API_TENANT_CONF_ENABLE_RECOMMENDATION_KEY); return Boolean.parseBoolean(value.toString()); } } catch (UserStoreException | RegistryException | NullPointerException e) { log.error("Error occurred when getting API tenant config from registry", e); } } } return false; }
Source:
private boolean evaluateNode(TreeMapState state, String[] pathValues, DataTreeNode reference) { boolean updated = false; if (reference != null) { FieldValueList valueList = new FieldValueList(state.getFormat()); if (values.update(valueList, reference, state) == 0) { return false; } switch (childMatch) { case AS_LIST: updated = valueList.updateBundleWithListAppend(state.getBundle()); break; case AS_MAP: updated = valueList.updateBundleWithMapAppend(state.getBundle()); break; case NONE: updated = valueList.updateBundle(state.getBundle()); break; default: throw new IllegalStateException("Known childMatch value " + childMatch); } if (updated) { if (debug > 0) { debug(true); } } } else { logFailure(pathValues); } return updated; }

Target:
private boolean evaluateNode(TreeMapState state, String[] pathValues, DataTreeNode reference) { boolean updated = false; if (reference != null) { FieldValueList valueList = new FieldValueList(state.getFormat()); if (values.update(valueList, reference, state) == 0) { return false; } updated = childMatch.updateBundle(valueList, state.getBundle()); if (updated) { if (debug > 0) { debug(true); } } } else { logFailure(pathValues); } return updated; }
Source:
private void doFormating(StringBuilder buffer, String substring, Object... args) { String selector; String pattern; int colonPos = substring.indexOf(':'); if (colonPos == -1) { selector = substring; pattern = null; } else { selector = substring.substring(0, colonPos); pattern = substring.substring(colonPos + 1); } int pointPos = selector.indexOf('.'); Object object; try { if (pointPos == -1) { object = args[Integer.parseInt(selector)]; } else { int lastPointPos = pointPos; object = args[Integer.parseInt(selector.substring(0, pointPos))]; pointPos = selector.indexOf('.', pointPos + 1); while (pointPos != -1) { object = extractField(object, selector.substring(lastPointPos + 1, pointPos)); lastPointPos = pointPos; pointPos = selector.indexOf('.', pointPos + 1); } object = extractField(object, selector.substring(lastPointPos + 1)); } } catch (FormatterException e) { throw e; } catch (Throwable e) { throw new FormatterException( "An error while extracting field occured", e); } if (pattern == null) { if (object != null) { buffer.append(object.toString()); } } else { boolean thereIsNoGoodFormatter = true; for (StringFormatterExtension ext : extensions) { if (ext.supports(object.getClass())) { ext.format(buffer, object, pattern); thereIsNoGoodFormatter = false; break; } } if (thereIsNoGoodFormatter) { throw new FormatterException( "There is no good formatter for class " + object.getClass().getName()); } } }

Target:
private void doFormating(StringBuilder buffer, String substring, Object... args) { String selector; String pattern; int colonPos = substring.indexOf(':'); if (colonPos == -1) { selector = substring; pattern = null; } else { selector = substring.substring(0, colonPos); pattern = substring.substring(colonPos + 1); } int pointPos = selector.indexOf('.'); Object object; try { if (pointPos == -1) { object = args[Integer.parseInt(selector)]; } else { int lastPointPos = pointPos; object = args[Integer.parseInt(selector.substring(0, pointPos))]; pointPos = selector.indexOf('.', pointPos + 1); while (pointPos != -1) { object = extractField(object, selector.substring(lastPointPos + 1, pointPos)); lastPointPos = pointPos; pointPos = selector.indexOf('.', pointPos + 1); } object = extractField(object, selector.substring(lastPointPos + 1)); } } catch (FormatterException e) { throw e; } catch (Throwable e) { throw new FormatterException( "An error while extracting field occurred", e); } if (pattern == null) { if (object != null) { buffer.append(object.toString()); } } else { boolean thereIsNoGoodFormatter = true; for (StringFormatterExtension ext : extensions) { if (ext.supports(object.getClass())) { ext.format(buffer, object, pattern); thereIsNoGoodFormatter = false; break; } } if (thereIsNoGoodFormatter) { throw new FormatterException( "There is no good formatter for class " + object.getClass().getName()); } } }
Source:
public ReconcilerRegistry() { Platform.getExtensionRegistry().addRegistryChangeListener(new IRegistryChangeListener() { @Override public void registryChanged(IRegistryChangeEvent event) { outOfSync = true; highlightOutOfSync = true; } }, EXTENSION_POINT_ID); Platform.getExtensionRegistry().addRegistryChangeListener(new IRegistryChangeListener() { @Override public void registryChanged(IRegistryChangeEvent event) { outOfSync = true; highlightOutOfSync = true; } }, HIGHLIGHT_EXTENSION_POINT_ID); }

Target:
public ReconcilerRegistry() { Platform.getExtensionRegistry().addRegistryChangeListener(event -> { outOfSync = true; }, EXTENSION_POINT_ID); Platform.getExtensionRegistry().addRegistryChangeListener(event -> { highlightOutOfSync = true; }, HIGHLIGHT_EXTENSION_POINT_ID); }
Source:
public Term parse(NonTerminal nt, int position) { assert nt != null : "Start symbol cannot be null."; activateStateCall(s.stateCalls.get(new StateCall.Key(s.ntCalls.get( new NonTerminalCall.Key(nt, position)), position, nt.entryState)), Function.IDENTITY); for (StateReturn stateReturn; (stateReturn = s.stateReturnWorkList.dequeue()) != null;) { this.workListStep(stateReturn); } Ambiguity result = Ambiguity.apply(new HashSet<>()); for(StateReturn stateReturn : s.ntCalls.get(new NonTerminalCall.Key(nt,position)).exitStateReturns) { if (stateReturn.key.stateEnd == s.input.length()) { result.items().add(KList.apply(ConsPStack.singleton(Ambiguity.apply(stateReturn.function.values)))); } } if(result.equals(Ambiguity.apply())) { CharSequence content = s.input; ParseError perror = getErrors(); String msg = content.length() == perror.position ? "Parse error: unexpected end of file." : "Parse error: unexpected character '" + content.charAt(perror.position) + "'."; if (content.toString().indexOf('`')>=0) msg += "Please use '(' or ')' instead of '`'"; Location loc = new Location(perror.line, perror.column, perror.line, perror.column + 1); Source source = perror.source; throw new ParseFailedException(new KException( ExceptionType.ERROR, KExceptionGroup.INNER_PARSER, msg, source, loc)); } return result; }

Target:
public Term parse(NonTerminal nt, int position) { assert nt != null : "Start symbol cannot be null."; activateStateCall(s.stateCalls.get(new StateCall.Key(s.ntCalls.get( new NonTerminalCall.Key(nt, position)), position, nt.entryState)), Function.IDENTITY); for (StateReturn stateReturn; (stateReturn = s.stateReturnWorkList.dequeue()) != null;) { this.workListStep(stateReturn); } Ambiguity result = Ambiguity.apply(new HashSet<>()); for(StateReturn stateReturn : s.ntCalls.get(new NonTerminalCall.Key(nt,position)).exitStateReturns) { if (stateReturn.key.stateEnd == s.input.length()) { result.items().add(KList.apply(ConsPStack.singleton(Ambiguity.apply(stateReturn.function.values)))); } } if(result.equals(Ambiguity.apply())) { CharSequence content = s.input; ParseError perror = getErrors(); String msg = content.length() == perror.position ? "Parse error: unexpected end of file." : "Parse error: unexpected character '" + content.charAt(perror.position) + "'."; if (content.toString().indexOf('`')>=0) msg += "Using backtick, '`', for K brackets is deprecated. If you are using it for this purpose, please use regular parenthesis, '(' and ')', instead."; Location loc = new Location(perror.line, perror.column, perror.line, perror.column + 1); Source source = perror.source; throw new ParseFailedException(new KException( ExceptionType.ERROR, KExceptionGroup.INNER_PARSER, msg, source, loc)); } return result; }
Source:
public void testSolveSymbolInTypeCantResolveNonExistantField() { SymbolReference<? extends ResolvedValueDeclaration> solvedSymbol = symbolSolver.solveSymbolInType(classDeclarationConcreteClass, "FIELD_THAT_DOES_NOT_EXIST"); assertFalse(solvedSymbol.isSolved()); try { solvedSymbol.getCorrespondingDeclaration(); } catch (Exception e) { assertTrue(e instanceof UnsupportedOperationException); assertNull(e.getMessage()); return; } fail("Expected UnsupportedOperationException when requesting CorrespondingDeclaration on unsolved SymbolRefernce"); }

Target:
public void testSolveSymbolInTypeCantResolveNonExistantField() { SymbolReference<? extends ResolvedValueDeclaration> solvedSymbol = symbolSolver.solveSymbolInType(classDeclarationConcreteClass, "FIELD_THAT_DOES_NOT_EXIST"); assertFalse(solvedSymbol.isSolved()); try { solvedSymbol.getCorrespondingDeclaration(); } catch (Exception e) { assertTrue(e instanceof UnsupportedOperationException); assertEquals("CorrespondingDeclaration not available for unsolved symbol.", e.getMessage()); return; } fail("Expected UnsupportedOperationException when requesting CorrespondingDeclaration on unsolved SymbolRefernce"); }
Source:
public String getHelpText() { return EMPTY_STRING; }

Target:
public String getHelpText() { return Messages.getMessage(Messages.AspectHelpText_Channel); }
Source:
private static void updateOption(VdcOption option) { Map<String, Object> values = _vdcOptionCache.get(option.getoption_name()); if (values == null) { values = new HashMap<String, Object>(); _vdcOptionCache.put(option.getoption_name(), values); } log.info("In updateOption decrypting and saving option "+option.getoption_name()+" version = "+option.getversion()); values.put(option.getversion(), GetValue(option)); }

Target:
private static void updateOption(VdcOption option) { Map<String, Object> values = _vdcOptionCache.get(option.getoption_name()); if (values == null) { values = new HashMap<String, Object>(); _vdcOptionCache.put(option.getoption_name(), values); } values.put(option.getversion(), GetValue(option)); }