auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected String getDataProfileFromNameSpace(NameSpace nameSpace) { switch (nameSpace) { case STATION: return Profile.STATION.toString(); case SIMPLE_STATION: case STATION_KML: return Profile.SIMPLE_STATION.toString(); case SUMMARY_STATION: return Profile.SUMMARY_STATION.toString(); case SUMMARY_ORGANIZATION: return Profile.SUMMARY_STATION.toString(); case PROJECT: return Profile.PROJECT.toString(); case PROJECT_MONITORING_LOCATION_WEIGHTING: return Profile.PROJECT_MONITORING_LOCATION_WEIGHTING.toString(); case ACTIVITY: return Profile.ACTIVITY.toString(); case ACTIVITY_METRIC: return Profile.ACTIVITY_METRIC.toString(); case RESULT: return Profile.PC_RESULT.toString(); case BIOLOGICAL_RESULT: return Profile.BIOLOGICAL.toString(); case NARROW_RESULT: return Profile.NARROW_RESULT.toString(); case RES_DETECT_QNT_LMT: return Profile.RES_DETECT_QNT_LMT.toString(); default: return null; } }

Target:
protected String getDataProfileFromNameSpace(NameSpace nameSpace) { switch (nameSpace) { case STATION: return Profile.STATION.toString(); case SIMPLE_STATION: case STATION_KML: return Profile.SIMPLE_STATION.toString(); case SUMMARY_STATION: return Profile.SUMMARY_STATION.toString(); case SUMMARY_ORGANIZATION: return Profile.SUMMARY_ORGANIZATION.toString(); case PROJECT: return Profile.PROJECT.toString(); case PROJECT_MONITORING_LOCATION_WEIGHTING: return Profile.PROJECT_MONITORING_LOCATION_WEIGHTING.toString(); case ACTIVITY: return Profile.ACTIVITY.toString(); case ACTIVITY_METRIC: return Profile.ACTIVITY_METRIC.toString(); case RESULT: return Profile.PC_RESULT.toString(); case BIOLOGICAL_RESULT: return Profile.BIOLOGICAL.toString(); case NARROW_RESULT: return Profile.NARROW_RESULT.toString(); case RES_DETECT_QNT_LMT: return Profile.RES_DETECT_QNT_LMT.toString(); default: return null; } }
Source:
public void fromStream_providesToken() throws IOException { MockTokenServerTransportFactory transportFactory = new MockTokenServerTransportFactory(); transportFactory.transport.addServiceAccount(SA_CLIENT_EMAIL, ACCESS_TOKEN); InputStream serviceAccountStream = ServiceAccountCredentialsTest .writeServiceAccountAccountStream( SA_CLIENT_ID, SA_CLIENT_EMAIL, SA_PRIVATE_KEY_PKCS8, SA_PRIVATE_KEY_ID); GoogleCredentials credentials = ServiceAccountCredentials.fromStream(serviceAccountStream, transportFactory); assertNotNull(credentials); credentials = credentials.createScoped(SCOPES); Map<String, List<String>> metadata = credentials.getRequestMetadata(CALL_URI); TestUtils.assertContainsBearerToken(metadata, ACCESS_TOKEN); }

Target:
public void fromStream_providesToken() throws IOException { MockTokenServerTransportFactory transportFactory = new MockTokenServerTransportFactory(); transportFactory.transport.addServiceAccount(SA_CLIENT_EMAIL, ACCESS_TOKEN); InputStream serviceAccountStream = writeServiceAccountStream( SA_CLIENT_ID, SA_CLIENT_EMAIL, SA_PRIVATE_KEY_PKCS8, SA_PRIVATE_KEY_ID); GoogleCredentials credentials = ServiceAccountCredentials.fromStream(serviceAccountStream, transportFactory); assertNotNull(credentials); credentials = credentials.createScoped(SCOPES); Map<String, List<String>> metadata = credentials.getRequestMetadata(CALL_URI); TestUtils.assertContainsBearerToken(metadata, ACCESS_TOKEN); }
Source:
public void revealShroudFor(int x, int y, int range) { if (range < 1) return; float halfATile = TILE_SIZE / 2; Vector2D asPixelsCentered = getCellCoordinatesInAbsolutePixels(x, y). add(Vector2D.create(halfATile, halfATile)); double centerX = asPixelsCentered.getX(), centerY = asPixelsCentered.getY(); for (int rangeStep=0; rangeStep < range; rangeStep++) { for (int degrees=0; degrees < 360; degrees++) { float rangeInPixels = (rangeStep * TILE_SIZE); double radians = Math.toRadians(degrees); double circleX = (centerX + (Math.cos(radians) * rangeInPixels)); double circleY = (centerY + (Math.sin(radians) * rangeInPixels)); Cell cell = getCellByAbsolutePixelCoordinates((int) Math.ceil(circleX), (int) Math.ceil(circleY)); cell.setShrouded(false); } } }

Target:
public void revealShroudFor(int x, int y, int range) { if (range < 1) return; float halfATile = TILE_SIZE / 2; Vector2D asPixelsCentered = getCellCoordinatesInAbsolutePixels(x, y). add(Vector2D.create(halfATile, halfATile)); double centerX = asPixelsCentered.getX(), centerY = asPixelsCentered.getY(); for (int rangeStep=0; rangeStep < range; rangeStep++) { for (int degrees=0; degrees < 360; degrees++) { float rangeInPixels = (rangeStep * TILE_SIZE); double circleX = (centerX + (Trigonometry.cos[degrees] * rangeInPixels)); double circleY = (centerY + (Trigonometry.sin[degrees] * rangeInPixels)); Cell cell = getCellByAbsolutePixelCoordinates((int) Math.ceil(circleX), (int) Math.ceil(circleY)); cell.setShrouded(false); } } }
Source:
public void testListImages() { List<ImageSummary> listImages = api().listImages(); assertNotNull(listImages); ImageSummary taggedImage = Iterables.find(listImages, new Predicate<ImageSummary>() { @Override public boolean apply(ImageSummary input) { return input.repoTags().contains("jclouds:testTag"); } }); assertNotNull(taggedImage); }

Target:
public void testListImages() { List<ImageSummary> listImages = api().listImages(); assertNotNull(listImages); Iterables.find(listImages, new Predicate<ImageSummary>() { @Override public boolean apply(ImageSummary input) { return input.repoTags().contains("jclouds:testTag"); } }); }
Source:
protected void onPostExecute(File result) { Fragment prev = formEntryActivity.get().getSupportFragmentManager().findFragmentByTag(ProgressDialogFragment.COLLECT_PROGRESS_DIALOG_TAG); if (prev != null && !formEntryActivity.get().isInstanceStateSaved()) { ((DialogFragment) prev).dismiss(); } ODKView odkView = formEntryActivity.get().getCurrentViewIfODKView(); if (odkView != null) { formEntryActivity.get().setBinaryWidgetData(result); } }

Target:
protected void onPostExecute(File result) { Fragment prev = formEntryActivity.get().getSupportFragmentManager().findFragmentByTag(ProgressDialogFragment.COLLECT_PROGRESS_DIALOG_TAG); if (prev != null && !formEntryActivity.get().isInstanceStateSaved()) { ((DialogFragment) prev).dismiss(); } formEntryActivity.get().setBinaryWidgetData(result); }
Source:
public String getHowTo() { return "This action will destroy the content. Warning: this can't be undone!"; }

Target:
public String getHowTo() { return "This will destroy the content in ALL languages that exist and cannot be undone"; }
Source:
private String descForStatus(String str) { if (str.length() < 2) return null; String indexDesc = descForStatus(str.charAt(0)); String treeDesc = descForStatus(str.charAt(1)); if (indexDesc.length() > 0 && treeDesc.length() > 0) return indexDesc + "/" + treeDesc; else if (indexDesc.length() > 0) return indexDesc; else if (treeDesc.length() > 0) return treeDesc; else return ""; }

Target:
private String descForStatus(String str) { if (str.length() < 2) return ""; String indexDesc = descForStatus(str.charAt(0)); String treeDesc = descForStatus(str.charAt(1)); if (indexDesc.length() > 0 && treeDesc.length() > 0) return indexDesc + "/" + treeDesc; else if (indexDesc.length() > 0) return indexDesc; else if (treeDesc.length() > 0) return treeDesc; else return ""; }
Source:
public void cleanupVirtualMachineNICs(VirtualMachine virtualMachine) { for (NetworkInterface nicRef : virtualMachine.properties().networkProfile().networkInterfaces()) { String nicResourceGroup = extractResourceGroup(nicRef.id()); String nicName = extractName(nicRef.id()); NetworkInterfaceCard nic = api.getNetworkInterfaceCardApi(nicResourceGroup).get(nicName); Iterable<IdReference> publicIps = getPublicIps(nic); logger.debug(">> destroying nic %s...", nicName); URI nicDeletionURI = api.getNetworkInterfaceCardApi(nicResourceGroup).delete(nicName); resourceDeleted.apply(nicDeletionURI); for (IdReference publicIp : publicIps) { String publicIpResourceGroup = publicIp.resourceGroup(); String publicIpName = publicIp.name(); logger.debug(">> deleting public ip nic %s...", publicIpName); api.getPublicIPAddressApi(publicIpResourceGroup).delete(publicIpName); } } }

Target:
public void cleanupVirtualMachineNICs(VirtualMachine virtualMachine) { for (NetworkInterface nicRef : virtualMachine.properties().networkProfile().networkInterfaces()) { String nicResourceGroup = extractResourceGroup(nicRef.id()); String nicName = extractName(nicRef.id()); NetworkInterfaceCard nic = api.getNetworkInterfaceCardApi(nicResourceGroup).get(nicName); Iterable<IdReference> publicIps = getPublicIps(nic); logger.debug(">> destroying nic %s...", nicName); URI nicDeletionURI = api.getNetworkInterfaceCardApi(nicResourceGroup).delete(nicName); resourceDeleted.apply(nicDeletionURI); for (IdReference publicIp : publicIps) { String publicIpResourceGroup = publicIp.resourceGroup(); String publicIpName = publicIp.name(); PublicIPAddress ip = api.getPublicIPAddressApi(publicIpResourceGroup).get(publicIpName); if (ip.tags() != null && Boolean.parseBoolean(ip.tags().get(AUTOGENERATED_IP_KEY))) { logger.debug(">> deleting public ip %s...", publicIpName); api.getPublicIPAddressApi(publicIpResourceGroup).delete(publicIpName); } } } }
Source:
private LeaderPingResult actuallyPingLeaderWithUuid( MultiplexingCompletionService<LeaderPingerContext<PingableLeader>, PingResult> multiplexingCompletionService, UUID uuid, LeaderPingerContext<PingableLeader> leader, Callable<PingResult> pingEndpoint) throws ExecutionException { try { multiplexingCompletionService.submit(leader, pingEndpoint); Future<Map.Entry<LeaderPingerContext<PingableLeader>, PingResult>> pingFuture = multiplexingCompletionService.poll(leaderPingResponseWait.toMillis(), TimeUnit.MILLISECONDS); return getLeaderPingResult(uuid, pingFuture, timeLockVersion); } catch (InterruptedException exc) { Thread.currentThread().interrupt(); return LeaderPingResults.pingCallFailure(exc); } catch (CheckedRejectedExecutionException e) { log.warn("Could not ping the leader, because the executor used to talk to that node is overloaded", e); return LeaderPingResults.pingCallFailure(e); } }

Target:
private LeaderPingResult actuallyPingLeaderWithUuid( MultiplexingCompletionService<LeaderPingerContext<PingableLeader>, PingResult> multiplexingCompletionService, UUID uuid, LeaderPingerContext<PingableLeader> leader, Callable<PingResult> pingEndpoint) { try { multiplexingCompletionService.submit(leader, pingEndpoint); Future<Map.Entry<LeaderPingerContext<PingableLeader>, PingResult>> pingFuture = multiplexingCompletionService.poll(leaderPingResponseWait.toMillis(), TimeUnit.MILLISECONDS); return getLeaderPingResult(uuid, pingFuture, timeLockVersion); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return LeaderPingResults.pingCallFailure(e); } catch (CheckedRejectedExecutionException e) { log.warn("Could not ping the leader, because the executor used to talk to that node is overloaded", e); return LeaderPingResults.pingCallFailure(e); } }
Source:
public void onRequestSuggestions(final Request req, final Callback callback) { RpcStatus.hide(new Runnable() { public void run() { SuggestUtil.SVC.suggestAccount(req.getQuery(), new Boolean(true), req.getLimit(), new GerritCallback<List<AccountInfo>>() { public void onSuccess(final List<AccountInfo> result) { final ArrayList<AccountSuggestion> r = new ArrayList<AccountSuggestion>(result.size()); for (final AccountInfo p : result) { r.add(new AccountSuggestion(p)); } callback.onSuggestionsReady(req, new Response(r)); } }); } }); }

Target:
public void onRequestSuggestions(final Request req, final Callback callback) { RpcStatus.hide(new Runnable() { public void run() { SuggestUtil.SVC.suggestAccount(req.getQuery(), Boolean.TRUE, req.getLimit(), new GerritCallback<List<AccountInfo>>() { public void onSuccess(final List<AccountInfo> result) { final ArrayList<AccountSuggestion> r = new ArrayList<AccountSuggestion>(result.size()); for (final AccountInfo p : result) { r.add(new AccountSuggestion(p)); } callback.onSuggestionsReady(req, new Response(r)); } }); } }); }
Source:
void cancel() { if (callback != null) { callback = null; } ImageView target = this.target.get(); if (target == null) { return; } ViewTreeObserver vto = target.getViewTreeObserver(); if (!vto.isAlive()) { return; } vto.removeOnPreDrawListener(this); }

Target:
void cancel() { callback = null; ImageView target = this.target.get(); if (target == null) { return; } ViewTreeObserver vto = target.getViewTreeObserver(); if (!vto.isAlive()) { return; } vto.removeOnPreDrawListener(this); }
Source:
protected Password engineGeneratePassword(final String algorithm, final KeySpec keySpec) throws InvalidKeySpecException { switch (algorithm) { case ALGORITHM_CLEAR: { if (keySpec instanceof ClearPasswordSpec) { return new ClearPasswordImpl(((ClearPasswordSpec)keySpec).getEncodedPassword().clone()); } else { break; } } case ALGORITHM_SHACRYPT: { if (keySpec instanceof UnixSHACryptPasswordSpec) { UnixSHACryptPasswordSpec spec = (UnixSHACryptPasswordSpec) keySpec; try { return new UnixSHACryptPasswordImpl(UnixSHACryptPasswordUtil.encode(spec)); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } } else { break; } } } throw new InvalidKeySpecException(); }

Target:
protected Password engineGeneratePassword(final String algorithm, final KeySpec keySpec) throws InvalidKeySpecException { switch (algorithm) { case ALGORITHM_CLEAR: { if (keySpec instanceof ClearPasswordSpec) { return new ClearPasswordImpl(((ClearPasswordSpec)keySpec).getEncodedPassword().clone()); } else { break; } } case ALGORITHM_SHA256CRYPT: case ALGORITHM_SHA512CRYPT: { if (keySpec instanceof UnixSHACryptPasswordSpec) { UnixSHACryptPasswordSpec spec = (UnixSHACryptPasswordSpec) keySpec; try { return new UnixSHACryptPasswordImpl(UnixSHACryptPasswordUtil.encode(spec)); } catch (NoSuchAlgorithmException e) { throw new InvalidKeySpecException("Cannot read key spec", e); } } else { break; } } } throw new InvalidKeySpecException(); }
Source:
protected void readInternal(ObjectDataInput in) throws IOException { super.readInternal(in); int s = in.readInt(); keys = new ArrayList<Data>(); while (s-- > 0) { keys.add(in.readData()); } expiryPolicy = in.readData(); }

Target:
protected void readInternal(ObjectDataInput in) throws IOException { super.readInternal(in); int s = in.readInt(); keys = new ArrayList<Data>(s); while (s-- > 0) { keys.add(in.readData()); } expiryPolicy = in.readData(); }
Source:
public void testFindCodeTypeById() throws Exception { ICodeService remoteService = createRemoteService(); CodeServiceClientProxy service = createServiceUnderTest(remoteService); List<ICodeType<?, ?>> codeTypes = service.getAllCodeTypes(""); assertEquals("size", 2, codeTypes.size()); ICodeType<Long, ?> companyTypeCodeType = service.findCodeTypeById(CompanyTypeCodeType.ID); assertEquals("CompanyTypeCodeType class", CompanyTypeCodeType.class, companyTypeCodeType.getClass()); ICodeType<Long, ?> companyRatingCodeType = service.findCodeTypeById(CompanyRatingCodeType.ID); assertEquals("CompanyRatingCodeType 2 class", CompanyRatingCodeType.class, companyRatingCodeType.getClass()); ICodeType<Long, ?> companyRatingCodeType2 = service.findCodeTypeById(CompanyRatingCodeType.ID); assertEquals("CompanyRatingCodeType class", CompanyRatingCodeType.class, companyRatingCodeType2.getClass()); assertEquals("CompanyRatingCodeType classes are the same", true, companyRatingCodeType == companyRatingCodeType2); verify(remoteService, times(1)).getAllCodeTypeClasses(""); verify(remoteService, times(1)).getCodeTypes(anyListOfCodeTypes()); verifyNoMoreInteractions(remoteService); }

Target:
public void testFindCodeTypeById() throws Exception { List<ICodeType<?, ?>> codeTypes = m_service.getAllCodeTypes(""); assertEquals("size", 2, codeTypes.size()); ICodeType<Long, ?> companyTypeCodeType = m_service.findCodeTypeById(CompanyTypeCodeType.ID); assertEquals("CompanyTypeCodeType class", CompanyTypeCodeType.class, companyTypeCodeType.getClass()); ICodeType<Long, ?> companyRatingCodeType = m_service.findCodeTypeById(CompanyRatingCodeType.ID); assertEquals("CompanyRatingCodeType 2 class", CompanyRatingCodeType.class, companyRatingCodeType.getClass()); ICodeType<Long, ?> companyRatingCodeType2 = m_service.findCodeTypeById(CompanyRatingCodeType.ID); assertEquals("CompanyRatingCodeType class", CompanyRatingCodeType.class, companyRatingCodeType2.getClass()); assertTrue("CompanyRatingCodeType classes are the same", companyRatingCodeType == companyRatingCodeType2); verify(m_remoteService, times(1)).getAllCodeTypeClasses(""); verify(m_remoteService, times(1)).getCodeTypes(anyListOfCodeTypes()); verifyNoMoreInteractions(m_remoteService); }
Source:
protected void executeRequest(OkHttpClient httpClient, Request request) { Object contentBody = null; long contentSize = 0; Throwable error = null; Response response = null; try { try { Log.v(TAG, "%s: RemoteRequest calling httpClient.execute, url: %s", this, url); call = httpClient.newCall(request); response = call.execute(); Log.v(TAG, "%s: RemoteRequest called httpClient.execute, url: %s", this, url); storeCookie(response); if (response.code() >= 300) { if (!dontLog404) Log.w(TAG, "%s: Got error status: %d for %s. Reason: %s", this, response.code(), url, response.message()); String authHeader = response.header("WWW-Authenticate"); Map<String, String> challenge = parseAuthHeader(authHeader); Map<String, Object> extra = null; if (challenge != null) { extra = new HashMap(); extra.put("AuthChallenge", challenge); } error = new RemoteRequestResponseException(response.code(), response.message(), extra); RequestUtils.closeResponseBody(response); } else { InputStream stream = response.body().byteStream(); try { if (Utils.isGzip(response)) stream = new GZIPInputStream(stream); contentBody = Manager.getObjectMapper().readValue(stream, Object.class); contentSize = response.body().contentLength(); } finally { try { stream.close(); } catch (IOException e) { } } } } catch (Exception e) { Log.w(TAG, "%s: executeRequest() Exception: %s. url: %s", e, this, e, url); error = e; } respondWithResult(contentBody, contentSize, error, response); } finally { RequestUtils.closeResponseBody(response); } }

Target:
protected void executeRequest(OkHttpClient httpClient, Request request) { Object fullBody = null; Throwable error = null; Response response = null; try { try { Log.v(TAG, "%s: RemoteRequest calling httpClient.execute, url: %s", this, url); call = httpClient.newCall(request); response = call.execute(); Log.v(TAG, "%s: RemoteRequest called httpClient.execute, url: %s", this, url); storeCookie(response); if (response.code() >= 300) { if (!dontLog404) Log.w(TAG, "%s: Got error status: %d for %s. Reason: %s", this, response.code(), url, response.message()); String authHeader = response.header("WWW-Authenticate"); Map<String, String> challenge = parseAuthHeader(authHeader); Map<String, Object> extra = null; if (challenge != null) { extra = new HashMap(); extra.put("AuthChallenge", challenge); } error = new RemoteRequestResponseException(response.code(), response.message(), extra); RequestUtils.closeResponseBody(response); } else { InputStream stream = response.body().byteStream(); try { if (Utils.isGzip(response)) stream = new GZIPInputStream(stream); fullBody = Manager.getObjectMapper().readValue(stream, Object.class); } finally { try { stream.close(); } catch (IOException e) { } } } } catch (Exception e) { Log.w(TAG, "%s: executeRequest() Exception: %s. url: %s", e, this, e, url); error = e; } respondWithResult(fullBody, error, response); } finally { RequestUtils.closeResponseBody(response); } }
Source:
public Activity(String appPackage, String appActivity) { this.appPackage = appPackage; this.appActivity = appActivity; this.stopApp = true; }

Target:
public Activity(String appPackage, String appActivity) { checkArgument(!isBlank(appPackage), "App package should be defined as not empty or null string"); checkArgument(!isBlank(appActivity), "App activity should be defined as not empty or null string"); this.appPackage = appPackage; this.appActivity = appActivity; this.stopApp = true; }
Source:
public void testImpsersonationServiceAccountUsed() throws Exception { Configuration config = new Configuration(); config.set("fs.gs.auth.access.token.provider.impl", TestingAccessTokenProvider.class.getName()); config.set( GCS_CONFIG_PREFIX + IMPERSONATION_SERVICE_ACCOUNT_SUFFIX.getKey(), "test-service-account"); URI gsUri = new URI("gs://foobar/"); GoogleHadoopFileSystem ghfs = new GoogleHadoopFileSystem(); assertThrows(GoogleJsonResponseException.class, () -> {ghfs.initialize(gsUri, config);}); }

Target:
public void testImpsersonationServiceAccountUsed() throws Exception { Configuration config = new Configuration(); config.setClass( "fs.gs.auth.access.token.provider.impl", TestingAccessTokenProvider.class, AccessTokenProvider.class); config.set( GCS_CONFIG_PREFIX + IMPERSONATION_SERVICE_ACCOUNT_SUFFIX.getKey(), "test-service-account"); URI gsUri = new URI("gs://foobar/"); GoogleHadoopFileSystem ghfs = new GoogleHadoopFileSystem(); Exception exception = assertThrows( GoogleJsonResponseException.class, () -> { ghfs.initialize(gsUri, config); }); assertThat(exception).hasMessageThat().startsWith("401 Unauthorized"); }
Source:
public synchronized void write(Text key, CrawlDatum value) throws IOException { Map<String, Object> data = new LinkedHashMap<String, Object>(); data.put("url", key.toString()); data.put("statusCode", Integer.toString(value.getStatus())); data.put("statusName", CrawlDatum.getStatusName(value.getStatus())); data.put("fetchTime", new Date(value.getFetchTime()).toString()); data.put("modifiedTime", new Date(value.getModifiedTime()).toString()); data.put("retriesSinceFetch", Integer.toString(value.getRetriesSinceFetch())); data.put("retryIntervalSeconds", Float.toString(value.getFetchInterval())); data.put("retryIntervalDays", Float.toString( (value.getFetchInterval() / FetchSchedule.SECONDS_PER_DAY))); data.put("score", Float.toString(value.getScore())); data.put("signature", (value.getSignature() != null ? StringUtil.toHexString(value.getSignature()) : "null")); Map<String, String> metaData = null; if (value.getMetaData() != null) { metaData = new LinkedHashMap<String, String>(); for (Entry<Writable, Writable> e : value.getMetaData().entrySet()) { metaData.put(e.getKey().toString(), e.getValue().toString()); } } if (metaData != null) { data.put("metadata", metaData); } else { data.put("metadata", ""); } out.write(jsonWriter.writeValueAsBytes(data)); out.writeByte('\n'); }

Target:
public synchronized void write(Text key, CrawlDatum value) throws IOException { Map<String, Object> data = new LinkedHashMap<String, Object>(); data.put("url", key.toString()); data.put("statusCode", value.getStatus()); data.put("statusName", CrawlDatum.getStatusName(value.getStatus())); data.put("fetchTime", new Date(value.getFetchTime()).toString()); data.put("modifiedTime", new Date(value.getModifiedTime()).toString()); data.put("retriesSinceFetch", value.getRetriesSinceFetch()); data.put("retryIntervalSeconds", value.getFetchInterval()); data.put("retryIntervalDays", (value.getFetchInterval() / FetchSchedule.SECONDS_PER_DAY)); data.put("score", value.getScore()); data.put("signature", (value.getSignature() != null ? StringUtil.toHexString(value.getSignature()) : "null")); Map<String, Object> metaData = null; if (value.getMetaData() != null) { metaData = new LinkedHashMap<String, Object>(); for (Entry<Writable, Writable> e : value.getMetaData().entrySet()) { metaData.put(e.getKey().toString(), e.getValue()); } } if (metaData != null) { data.put("metadata", metaData); } else { data.put("metadata", ""); } out.write(jsonWriter.writeValueAsBytes(data)); out.writeByte('\n'); }
Source:
private Image getVerifiedStateImage(int verifiedState) { switch (verifiedState) { case 1: case 2: return CommonImages.getImage(ReviewsImages.GREEN_CHECK); case 0: break; case -1: case -2: return CommonImages.getImage(ReviewsImages.RED_NOT); } return null; }

Target:
private Image getVerifiedStateImage(int verifiedState) { if (verifiedState >= VERIFIED) { return CommonImages.getImage(ReviewsImages.GREEN_CHECK); } else { if (verifiedState <= NOT_VERIFIED) { return CommonImages.getImage(ReviewsImages.RED_NOT); } else { return null; } } }
Source:
public <T> SafeHtml replaceAll(List<? extends FindReplace> findReplaceList) { if (findReplaceList == null) { return this; } StringBuilder pat = new StringBuilder(); Iterator<? extends FindReplace> it = findReplaceList.iterator(); for (int i = 0; i < findReplaceList.size(); i++) { FindReplace fr = it.next(); pat.append(fr.pattern().getSource()); if (i != findReplaceList.size() - 1) { pat.append('|'); } } StringBuilder result = new StringBuilder(); RegExp re = RegExp.compile(pat.toString(), "g"); String orig = asString(); int index = 0; MatchResult mat; while ((mat = re.exec(orig)) != null) { String g = mat.getGroup(0); for (FindReplace fr : findReplaceList) { if (fr.pattern().test(g)) { try { String repl = fr.replace(g); result.append(orig.substring(index, mat.getIndex())); result.append(repl); } catch (IllegalArgumentException e) { continue; } index = mat.getIndex() + g.length(); break; } } } result.append(orig.substring(index, orig.length())); return asis(result.toString()); }

Target:
public <T> SafeHtml replaceAll(List<? extends FindReplace> findReplaceList) { if (findReplaceList == null) { return this; } StringBuilder pat = new StringBuilder(); Iterator<? extends FindReplace> it = findReplaceList.iterator(); while (it.hasNext()) { FindReplace fr = it.next(); pat.append(fr.pattern().getSource()); if (it.hasNext()) { pat.append('|'); } } StringBuilder result = new StringBuilder(); RegExp re = RegExp.compile(pat.toString(), "g"); String orig = asString(); int index = 0; MatchResult mat; while ((mat = re.exec(orig)) != null) { String g = mat.getGroup(0); for (FindReplace fr : findReplaceList) { if (fr.pattern().test(g)) { try { String repl = fr.replace(g); result.append(orig.substring(index, mat.getIndex())); result.append(repl); } catch (IllegalArgumentException e) { continue; } index = mat.getIndex() + g.length(); break; } } } result.append(orig.substring(index, orig.length())); return asis(result.toString()); }
Source:
private void innerDelete(final Path path, boolean tombstone, ITtlTimeProvider ttlTimeProvider) throws IOException { checkPath(path); LOG.debug("Deleting from table in region {}: {}", tableName, region, path); if (path.isRoot()) { LOG.debug("Skip deleting root directory as it does not exist in table"); return; } boolean idempotent = S3AFileSystem.DELETE_CONSIDERED_IDEMPOTENT; if (tombstone) { final PathMetadata pmTombstone = PathMetadata.tombstone(path); pmTombstone.setLastUpdated(ttlTimeProvider.getNow()); Item item = PathMetadataDynamoDBTranslation.pathMetadataToItem( new DDBPathMetadata(pmTombstone)); writeOp.retry( "Put tombstone", path.toString(), idempotent, () -> table.putItem(item)); } else { PrimaryKey key = pathToKey(path); writeOp.retry( "Delete key", path.toString(), idempotent, () -> table.deleteItem(key)); } }

Target:
private void innerDelete(final Path path, boolean tombstone, ITtlTimeProvider ttlTimeProvider) throws IOException { checkPath(path); LOG.debug("Deleting from table in region {}: {}", tableName, region, path); if (path.isRoot()) { LOG.debug("Skip deleting root directory as it does not exist in table"); return; } boolean idempotent = S3AFileSystem.DELETE_CONSIDERED_IDEMPOTENT; if (tombstone) { Preconditions.checkArgument(ttlTimeProvider != null, "ttlTimeProvider " + "must not be null"); final PathMetadata pmTombstone = PathMetadata.tombstone(path); pmTombstone.setLastUpdated(ttlTimeProvider.getNow()); Item item = PathMetadataDynamoDBTranslation.pathMetadataToItem( new DDBPathMetadata(pmTombstone)); writeOp.retry( "Put tombstone", path.toString(), idempotent, () -> table.putItem(item)); } else { PrimaryKey key = pathToKey(path); writeOp.retry( "Delete key", path.toString(), idempotent, () -> table.deleteItem(key)); } }
Source:
private Platform getPlatform() throws LauncherStartFailedException { logger.trace("Init Platform..."); updateMessage(BundleUtils.getLabel("splash_checkOS")); final Platform platform = Platform.getPlatform(); if (!platform.isLinux() && !platform.isMac() && !platform.isWindows()) { logger.warn("Detected unexpected platform: {}", platform); } logger.debug("Platform: {}", platform); return platform; }

Target:
private Platform getPlatform() { logger.trace("Init Platform..."); updateMessage(BundleUtils.getLabel("splash_checkOS")); final Platform platform = Platform.getPlatform(); if (!platform.isLinux() && !platform.isMac() && !platform.isWindows()) { logger.warn("Detected unexpected platform: {}", platform); } logger.debug("Platform: {}", platform); return platform; }
Source:
private void showBranchesDialog() { String[] branchList = new String[mBranches.size()]; int current = -1; int master = -1; for (int i = 0; i < mBranches.size(); i++) { branchList[i] = mBranches.get(i).getName(); if (mBranches.get(i).getCommit().getSha() == mSelectedRef) { current = i; } if (mBranches.get(i).getName().equals("master")) { master = i; } } if (mSelectedRef == null && current == -1) { current = master; } AlertDialog.Builder builder = UiUtils.createDialogBuilder(this); builder.setCancelable(true); builder.setTitle(R.string.repo_branches); builder.setSingleChoiceItems(branchList, current, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mSelectedRef = mBranches.get(which).getCommit().getSha(); mSelectBranchTag = mBranches.get(which).getName(); } }); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { refreshFragment(); } }); builder.setNegativeButton(R.string.cancel, null); builder.show(); }

Target:
private void showBranchesDialog() { String[] branchList = new String[mBranches.size()]; int current = -1; int master = -1; for (int i = 0; i < mBranches.size(); i++) { branchList[i] = mBranches.get(i).getName(); if (mBranches.get(i).getCommit().getSha().equals(mSelectedRef)) { current = i; } if(mBranches.get(i).getName().equals(mRepository.getMasterBranch())){ master = i; } } if (mSelectedRef == null && current == -1) { current = master; } AlertDialog.Builder builder = UiUtils.createDialogBuilder(this); builder.setCancelable(true); builder.setTitle(R.string.repo_branches); builder.setSingleChoiceItems(branchList, current, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mSelectedRef = mBranches.get(which).getCommit().getSha(); mSelectBranchTag = mBranches.get(which).getName(); } }); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { refreshFragment(); } }); builder.setNegativeButton(R.string.cancel, null); builder.show(); }
Source:
public void testCreateAccount() throws JSONException { String userName = "TEST_USER_NAME"; String userNickName = "TEST_USER_NICK_NAME"; String userPassword = "TEST_USER_PASSWORD"; String userEmail = "TEST_USER_EMAIL"; long enbale = 1; JSONObject accountJSON = new JSONObject(); accountJSON.put(AccountJSONEnum.USERNAME, userName); accountJSON.put(AccountJSONEnum.NICK_NAME, userNickName); accountJSON.put(AccountJSONEnum.PASSWORD, userPassword); accountJSON.put(AccountJSONEnum.EMAIL, userEmail); accountJSON.put(AccountJSONEnum.ENABLE, enbale); Response response = mClient.target(BASE_URL) .path("accounts") .request() .post(Entity.text(accountJSON.toString())); AccountObject account = AccountObject.get(userName); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); assertEquals(userName, account.getUsername()); assertEquals(userNickName, account.getNickName()); assertEquals(AccountDAO.getInstance().getMd5(userPassword), account.getPassword()); assertEquals(userEmail, account.getEmail()); assertEquals(true, account.getEnable()); }

Target:
public void testCreateAccount() throws JSONException { String userName = "TEST_USER_NAME"; String userNickName = "TEST_USER_NICK_NAME"; String userPassword = "TEST_USER_PASSWORD"; String userEmail = "TEST_USER_EMAIL"; int enbale = 1; JSONObject accountJSON = new JSONObject(); accountJSON.put(AccountJSONEnum.USERNAME, userName); accountJSON.put(AccountJSONEnum.NICK_NAME, userNickName); accountJSON.put(AccountJSONEnum.PASSWORD, userPassword); accountJSON.put(AccountJSONEnum.EMAIL, userEmail); accountJSON.put(AccountJSONEnum.ENABLE, enbale); Response response = mClient.target(BASE_URL) .path("accounts") .request() .post(Entity.text(accountJSON.toString())); AccountObject account = AccountObject.get(userName); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); assertEquals(userName, account.getUsername()); assertEquals(userNickName, account.getNickName()); assertEquals(AccountDAO.getMd5(userPassword), account.getPassword()); assertEquals(userEmail, account.getEmail()); assertEquals(true, account.getEnable()); }
Source:
private void safeCloseClient() { try { if (client != null) { client.close(); client = null; } } catch (final Exception e) { Logger.getLogger(this.getClass().getName()).log( org.jboss.logmanager.Level.WARNING, "Caught exception closing ModelControllerClient", e); } }

Target:
private void safeCloseClient() { try { if (client != null) { client.close(); client = null; } } catch (final Exception e) { Logger.getLogger(this.getClass().getName()).warnf(e, "Caught exception closing ModelControllerClient"); } }
Source:
private void onNonAssignableClass(String className, Class candidate) { if (expectedType.isInterface()) { if (ClassLoaderUtil.implementsInterfaceWithSameName(candidate, expectedType)) { LOGGER.fine("There appears to be a classloading conflict. " + "Class " + className + " loaded by " + candidate.getClassLoader() + " implements " + expectedType.getName() + " from its own class loader, but it does not implement " + expectedType.getName() + " loaded by " + expectedType.getClassLoader()); } else { if (candidate.getClassLoader() != expectedType.getClassLoader()) { LOGGER.fine("There appears to be a classloading conflict. " + "Class " + className + " loaded by " + candidate.getClassLoader() + " does not " + "implement an interface with name " + expectedType.getName() + " in both class loaders." + " The interface currently loaded by " + expectedType.getClassLoader()); } else { LOGGER.fine("The class " + candidate.getName() + " does not implement the expected " + "interface " + expectedType.getName()); } } } }

Target:
private void onNonAssignableClass(String className, Class candidate) { if (expectedType.isInterface()) { if (ClassLoaderUtil.implementsInterfaceWithSameName(candidate, expectedType)) { LOGGER.fine("There appears to be a classloading conflict. " + "Class " + className + " loaded by " + candidate.getClassLoader() + " implements " + expectedType.getName() + " from its own class loader, but it does not implement " + expectedType.getName() + " loaded by " + expectedType.getClassLoader()); } else { if (candidate.getClassLoader() != expectedType.getClassLoader()) { LOGGER.fine("There appears to be a classloading conflict. " + "Class " + className + " loaded by " + candidate.getClassLoader() + " does not " + "implement an interface with name " + expectedType.getName() + " in both class loaders. " + "The interface is currently loaded by " + expectedType.getClassLoader()); } else { LOGGER.fine("The class " + candidate.getName() + " does not implement the expected " + "interface " + expectedType.getName()); } } } }
Source:
boolean errorDuringInit() { if (isInit && initException != null) { return true; } return false; }

Target:
boolean errorDuringInit() { return (isInit && initException != null); }
Source:
private long extractTons(ReaderWay way, long flags, EncodedDoubleValue valueEncoder, List<String> keys) { String value = way.getFirstPriorityTag(keys); if (Helper.isEmpty(value)) return flags; double val; try { val = stringToTons(value); } catch (Throwable t) { LOG.warn("Unable to extract tons from malformed road attribute '{}' for way (OSM_ID = {}).", value, way.getId(), t); return flags; } return valueEncoder.setDoubleValue(flags, val); }

Target:
private long extractTons(ReaderWay way, long flags, EncodedDoubleValue valueEncoder, List<String> keys) { String value = way.getFirstPriorityTag(keys); if (Helper.isEmpty(value)) return flags; double val; try { val = stringToTons(value); } catch (Throwable t) { LOG.warn("Unable to extract tons from malformed road attribute '{}' for way (OSM_ID = {}).", value, way.getId(), t); return flags; } try { flags = valueEncoder.setDoubleValue(flags, val); } catch (IllegalArgumentException e) { LOG.warn("Unable to process tons value '{}' for way (OSM_ID = {}).", val, way.getId(), e); } return flags; }
Source:
public void flushInputBuffer() { boolean signal = false; fInputLock.lock(); try { if (!fInputBuffer.isEmpty()) { fInnerQueue.put(fInputBuffer); fInputBuffer = new ConcurrentLinkedDeque<>(); fInputBufferSize = 0; signal = true; } } catch (InterruptedException e) { Activator.instance().logError("Buffered queue interrupted", e); } finally { fInputLock.unlock(); } if (signal) { fOutputLock.lock(); try { fNotEmpty.signal(); } finally { fOutputLock.unlock(); } } }

Target:
public void flushInputBuffer() { boolean signal = false; fInputLock.lock(); try { if (!fInputBuffer.isEmpty()) { fInnerQueue.put(fInputBuffer); fInputBuffer = new ConcurrentLinkedDeque<>(); fInputBufferSize = 0; signal = true; } } catch (InterruptedException e) { Activator.instance().logError("Buffered queue interrupted", e); } finally { fInputLock.unlock(); } if (signal) { fOutputLock.lock(); try { fNotEmpty.signalAll(); } finally { fOutputLock.unlock(); } } }
Source:
private ByteBuf createByteBuffer(int i, long lid, long eid) { ByteBuf bb = Unpooled.buffer(4 + 16); bb.writeLong(lid); bb.writeLong(eid); bb.writeInt(i); return bb; }

Target:
private ByteBuf createByteBuffer(int i, long lid, long eid) { ByteBuf bb = Unpooled.buffer(4 + 16); bb.writeLong(lid); bb.writeLong(eid); bb.writeLong(eid - 1); bb.writeInt(i); return bb; }
Source:
public Reply<?> create(Request request) { NewOperatorDTO dto = request.read(NewOperatorDTO.class).as(Json.class); NewOperator operator = adapt(dto); Object id = repository.create(operator); return Reply.with(id).as(Json.class).ok(); }

Target:
public Reply<?> create(Request request) { NewOperatorDTO dto = request.read(NewOperatorDTO.class).as(Json.class); NewOperator operator = adapt(dto); Object id = repository.create(operator); IdDTO idDTO = new IdDTO(id); return Reply.with(idDTO).as(Json.class).ok(); }
Source:
public void run() throws Exception { File file = new File(SamplesKt.getPrefix() + "README.md"); Request request = new Request.Builder() .url("<LINK_0>") .post(RequestBody.create(file, MEDIA_TYPE_MARKDOWN)) .build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); System.out.println(response.body().string()); } }

Target:
public void run() throws Exception { File file = new File("README.md"); Request request = new Request.Builder() .url("<LINK_0>") .post(RequestBody.create(file, MEDIA_TYPE_MARKDOWN)) .build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); System.out.println(response.body().string()); } }
Source:
static List<InputSplit> combineSplits(PriorityQueue<LuceneIndexInputSplit> splits, long maxSize) { List<InputSplit> combinedSplits = Lists.newLinkedList(); LuceneIndexInputSplit currentSplit = splits.poll(); while (currentSplit != null) { while (currentSplit.getLength() < maxSize) { LuceneIndexInputSplit nextSplit = splits.peek(); if (nextSplit == null) { break; } if (currentSplit.getLength() + nextSplit.getLength() > maxSize) { break; } currentSplit.combine(nextSplit); splits.poll(); } combinedSplits.add(currentSplit); currentSplit = splits.poll(); } return combinedSplits; }

Target:
protected List<InputSplit> combineSplits(PriorityQueue<LuceneIndexInputSplit> splits, long maxSize) { List<InputSplit> combinedSplits = Lists.newLinkedList(); LuceneIndexInputSplit currentSplit = splits.poll(); while (currentSplit != null) { while (currentSplit.getLength() < maxSize) { LuceneIndexInputSplit nextSplit = splits.peek(); if (nextSplit == null) { break; } if (currentSplit.getLength() + nextSplit.getLength() > maxSize) { break; } currentSplit.combine(nextSplit); splits.poll(); } combinedSplits.add(currentSplit); currentSplit = splits.poll(); } return combinedSplits; }
Source:
private List<NormalizationPlan> calculatePlans(final TableName tableName) { try { final TableDescriptor tblDesc = masterServices.getTableDescriptors().get(tableName); if (tblDesc != null && !tblDesc.isNormalizationEnabled()) { LOG.debug("Skipping table because normalization is disabled in its table properties.", tableName); return Collections.emptyList(); } } catch (IOException e) { LOG.debug("Skipping table because unable to access its table descriptor.", tableName, e); return Collections.emptyList(); } if (masterServices.skipRegionManagementAction("region normalizer")) { return Collections.emptyList(); } final List<NormalizationPlan> plans = regionNormalizer.computePlansForTable(tableName); if (CollectionUtils.isEmpty(plans)) { LOG.debug("No normalization required for table {}.", tableName); return Collections.emptyList(); } return plans; }

Target:
private List<NormalizationPlan> calculatePlans(final TableName tableName) { if (masterServices.skipRegionManagementAction("region normalizer")) { return Collections.emptyList(); } try { final TableDescriptor tblDesc = masterServices.getTableDescriptors().get(tableName); if (tblDesc != null && !tblDesc.isNormalizationEnabled()) { LOG.debug("Skipping table because normalization is disabled in its table properties.", tableName); return Collections.emptyList(); } } catch (IOException e) { LOG.debug("Skipping table because unable to access its table descriptor.", tableName, e); return Collections.emptyList(); } final List<NormalizationPlan> plans = regionNormalizer.computePlansForTable(tableName); if (CollectionUtils.isEmpty(plans)) { LOG.debug("No normalization required for table {}.", tableName); return Collections.emptyList(); } return plans; }
Source:
public OAuth2Configurer<HttpSecurity> oauth2() throws Exception { return getOrApply(new OAuth2Configurer<>()); }

Target:
public OAuth2Configurer oauth2() throws Exception { return getOrApply(new OAuth2Configurer()); }
Source:
BlobStoreCompactor(String dataDir, String storeId, StoreKeyFactory storeKeyFactory, StoreConfig config, StoreMetrics metrics, DiskIOScheduler diskIOScheduler, Log srcLog, ScheduledExecutorService scheduler, MessageStoreRecovery recovery, Time time, UUID sessionId, UUID incarnationId) { this.dataDir = new File(dataDir); this.storeId = storeId; this.storeKeyFactory = storeKeyFactory; this.config = config; this.metrics = metrics; this.srcLog = srcLog; this.diskIOScheduler = diskIOScheduler; this.scheduler = scheduler; this.recovery = recovery; this.time = time; this.sessionId = sessionId; this.incarnationId = incarnationId; }

Target:
BlobStoreCompactor(String dataDir, String storeId, StoreKeyFactory storeKeyFactory, StoreConfig config, StoreMetrics metrics, DiskIOScheduler diskIOScheduler, Log srcLog, ScheduledExecutorService scheduler, MessageStoreRecovery recovery, Time time, UUID sessionId, UUID incarnationId) throws IOException, StoreException { this.dataDir = new File(dataDir); this.storeId = storeId; this.storeKeyFactory = storeKeyFactory; this.config = config; this.srcMetrics = metrics; tgtMetrics = new StoreMetrics(storeId + METRICS_SUFFIX, metrics.getRegistry()); this.srcLog = srcLog; this.diskIOScheduler = diskIOScheduler; this.scheduler = scheduler; this.recovery = recovery; this.time = time; this.sessionId = sessionId; this.incarnationId = incarnationId; fixStateIfRequired(); }
Source:
public void notIgnoredAfterOnCreateView() { assertFalse(myListFragment.didExecute); LayoutInflater inflater = mock(LayoutInflater.class); ViewGroup viewGroup = mock(ViewGroup.class); Bundle bundle = mock(Bundle.class); myListFragment.onCreateView(inflater, viewGroup, bundle); assertFalse(myListFragment.didExecute); myListFragment.ignoreWhenViewDestroyed(); assertTrue(myListFragment.didExecute); }

Target:
public void notIgnoredAfterOnCreateView() { assertFalse(myListFragment.didExecute); myListFragment.onCreateView(null, null, null); assertFalse(myListFragment.didExecute); myListFragment.ignoreWhenViewDestroyed(); assertTrue(myListFragment.didExecute); }
Source:
void configure(SSLParameters params, String[] supportedProtocols, String[] supportedCipherSuites) { if (supportedProtocols != null) params.setProtocols(protocolSelector.evaluate(supportedProtocols)); if (supportedCipherSuites != null) params.setCipherSuites(cipherSuiteSelector.evaluate(supportedCipherSuites)); params.setUseCipherSuitesOrder(useCipherSuitesOrder); params.setWantClientAuth(wantClientAuth); if (needClientAuth) params.setNeedClientAuth(needClientAuth); }

Target:
void configure(SSLParameters params, String[] supportedProtocols, String[] supportedCipherSuites) { Assert.checkNotNullParam("supportedProtocols", supportedProtocols); Assert.checkNotNullParam("supportedCipherSuites", supportedCipherSuites); params.setProtocols(protocolSelector.evaluate(supportedProtocols)); params.setCipherSuites(cipherSuiteSelector.evaluate(supportedCipherSuites)); params.setUseCipherSuitesOrder(useCipherSuitesOrder); params.setWantClientAuth(wantClientAuth); if (needClientAuth) params.setNeedClientAuth(needClientAuth); }
Source:
private SurveyInstanceDto findSurveyInstance(Long surveyInstanceId) { SurveyInstance instance = instanceDao.getByKey(surveyInstanceId); SurveyInstanceDto dto = null; if (instance != null) { dto = new SurveyInstanceDto(); DtoMarshaller.copyToDto(instance, dto); SurveyedLocaleDao slDao = new SurveyedLocaleDao(); SurveyedLocale sl = slDao.getById(instance.getSurveyedLocaleId()); if (sl != null) { dto.setSurveyedLocaleIdentifier(sl.getIdentifier()); dto.setSurveyedLocaleDisplayName(sl.getDisplayName()); } } return dto; }

Target:
private SurveyInstanceDto findSurveyInstance(Long surveyInstanceId) { SurveyInstance instance = instanceDao.getByKey(surveyInstanceId); SurveyInstanceDto dto = null; if (instance != null) { dto = new SurveyInstanceDto(); DtoMarshaller.copyToDto(instance, dto); SurveyedLocaleDao slDao = new SurveyedLocaleDao(); SurveyedLocale sl = slDao.getById(instance.getSurveyedLocaleId()); if (sl != null) { dto.setSurveyedLocaleIdentifier(sl.getIdentifier() == null ? "" : sl .getIdentifier()); dto.setSurveyedLocaleDisplayName(sl.getDisplayName() == null ? "" : sl .getDisplayName()); } } return dto; }
Source:
public void createCopyRequest() throws Exception { DocumentReference source = new DocumentReference("code", "Model", "Entity"); DocumentReference destination = new DocumentReference("code", Arrays.asList("Model", "Entity"), "WebHome"); CopyRequest copyRequest = requestFactory.createCopyRequest(source, destination); assertEquals(Arrays.asList(source), copyRequest.getEntityReferences()); assertEquals(destination.getLastSpaceReference(), copyRequest.getDestination()); assertEquals(Arrays.asList(RefactoringJobs.GROUP, "copy"), copyRequest.getId().subList(0, 2)); assertEquals(RefactoringJobs.COPY, copyRequest.getJobType()); assertEquals(this.userReference, copyRequest.getUserReference()); assertFalse(copyRequest.isDeep()); assertTrue(copyRequest.isUpdateLinks()); assertFalse(copyRequest.isInteractive()); assertTrue(copyRequest.isCheckRights()); }

Target:
public void createCopyRequest() throws Exception { DocumentReference source = new DocumentReference("code", "Model", "Entity"); DocumentReference destination = new DocumentReference("code", Arrays.asList("Model", "Entity"), "WebHome"); CopyRequest copyRequest = requestFactory.createCopyRequest(source, destination); assertEquals(Arrays.asList(source), copyRequest.getEntityReferences()); assertEquals(destination.getParent(), copyRequest.getDestination()); assertEquals(Arrays.asList(RefactoringJobs.GROUP, "copy"), copyRequest.getId().subList(0, 2)); assertEquals(RefactoringJobs.COPY, copyRequest.getJobType()); assertEquals(this.userReference, copyRequest.getUserReference()); assertFalse(copyRequest.isDeep()); assertTrue(copyRequest.isUpdateLinks()); assertFalse(copyRequest.isInteractive()); assertTrue(copyRequest.isCheckRights()); }