auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public DecoratableResourceMapping(ResourceMapping mapping) throws IOException { super(null); this.mapping = mapping; IProject[] projects = mapping.getProjects(); if(projects == null || projects.length == 0) return; Set<Repository> repositories = new HashSet<Repository>(projects.length); for(IProject prj : projects) { RepositoryMapping repoMapping = RepositoryMapping.getMapping(prj); if(repoMapping == null) continue; IndexDiffData diffData = GitLightweightDecorator.getIndexDiffDataOrNull(prj); if(diffData == null) continue; tracked = true; Repository repository = repoMapping.getRepository(); String repoRelative = makeRepoRelative(repository, prj) + "/"; Set<String> modified = diffData.getModified(); Set<String> conflicting = diffData.getConflicting(); if(containsPrefix(modified, repoRelative)) dirty = true; if(containsPrefix(conflicting, repoRelative)) conflicts = true; repositories.add(repository); } if(repositories.size() == 1) { Repository repository = repositories.iterator().next(); repositoryName = DecoratableResourceHelper .getRepositoryName(repository); branch = DecoratableResourceHelper.getShortBranch(repository); branchStatus = DecoratableResourceHelper .getBranchStatus(repository); } else if(repositories.size() > 1) { repositoryName = MULTIPLE; Set<String> branches = new HashSet<String>(repositories.size()); for (Repository repository : repositories) { branches.add(DecoratableResourceHelper .getShortBranch(repository)); } if (branches.size() == 1) { branch = branches.iterator().next(); } else { branch = MULTIPLE; } } }

Target:
public DecoratableResourceMapping(ResourceMapping mapping) throws IOException { super(null); this.mapping = mapping; IProject[] projects = mapping.getProjects(); if(projects == null || projects.length == 0) return; Set<Repository> repositories = new HashSet<Repository>(projects.length); for(IProject prj : projects) { RepositoryMapping repoMapping = RepositoryMapping.getMapping(prj); if(repoMapping == null) continue; IndexDiffData diffData = GitLightweightDecorator.getIndexDiffDataOrNull(prj); if(diffData == null) continue; tracked = true; Repository repository = repoMapping.getRepository(); String repoRelative = makeRepoRelative(repository, prj) + "/"; Set<String> modified = diffData.getModified(); Set<String> conflicting = diffData.getConflicting(); if(containsPrefix(modified, repoRelative)) dirty = true; if(containsPrefix(conflicting, repoRelative)) conflicts = true; repositories.add(repository); } if(repositories.size() == 1) { Repository repository = repositories.iterator().next(); repositoryName = DecoratableResourceHelper .getRepositoryName(repository); branch = DecoratableResourceHelper.getShortBranch(repository); branchStatus = DecoratableResourceHelper .getBranchStatus(repository); } else if(repositories.size() > 1) { repositoryName = MULTIPLE; Set<String> branches = new HashSet<String>(2); for (Repository repository : repositories) { branches.add(DecoratableResourceHelper .getShortBranch(repository)); if (branches.size() > 1) break; } if (branches.size() == 1) branch = branches.iterator().next(); else branch = MULTIPLE; } }
Source:
public static List<TopLevelItemDescriptor> all(Authentication a, ItemGroup c) { List<TopLevelItemDescriptor> result = new ArrayList<TopLevelItemDescriptor>(); ACL acl; if (c instanceof AccessControlled) { acl = ((AccessControlled) c).getACL(); } else if (c instanceof Item) { acl = ((Item) c).getACL(); } else { acl = Jenkins.getInstance().getACL(); } for (TopLevelItemDescriptor d: all()) { if (acl.hasCreatePermission(a, c, d) && d.isApplicableIn(c)) { result.add(d); } } return result; }

Target:
public static List<TopLevelItemDescriptor> all(Authentication a, ItemGroup c) { List<TopLevelItemDescriptor> result = new ArrayList<TopLevelItemDescriptor>(); ACL acl; if (c instanceof AccessControlled) { acl = ((AccessControlled) c).getACL(); } else { acl = Jenkins.getInstance().getACL(); } for (TopLevelItemDescriptor d: all()) { if (acl.hasCreatePermission(a, c, d) && d.isApplicableIn(c)) { result.add(d); } } return result; }
Source:
public void shouldFailValidationWithMoreThan10Keys() { Map<String, Object> metadata = new HashMap<>(); for (int i = 0; i < 11; i++) { metadata.put("key" + i, "value" + i); } ExternalMetadata invalidExternalMetadata = new ExternalMetadata(metadata); Set<ConstraintViolation<ExternalMetadata>> violations = validator.validate(invalidExternalMetadata); assertThat(violations.size(), is(1)); assertThat(violations.iterator().next().getMessage(), is("metadata cannot have more than 10 key-value pairs")); }

Target:
public void shouldFailValidationWithMoreThan10Keys() { Map<String, Object> metadata = IntStream.rangeClosed(1, 11).boxed() .collect(Collectors.toUnmodifiableMap(i -> "key" + i, i-> "value" + i)); ExternalMetadata invalidExternalMetadata = new ExternalMetadata(metadata); Set<ConstraintViolation<ExternalMetadata>> violations = validator.validate(invalidExternalMetadata); assertThat(violations.size(), is(1)); assertThat(violations.iterator().next().getMessage(), is("metadata cannot have more than 10 key-value pairs")); }
Source:
protected void contextMenuAboutToShow(IMenuManager menuManager) { menuManager.add(fCopyAction); menuManager.add(fPasteAction); menuManager.add(fSelectAllAction); menuManager.add(new Separator()); menuManager.add(fClearAction); menuManager.add(new Separator()); menuManager.add(fScrollLockAction); menuManager.add(new Separator()); menuManager.add(fTerminateLaunchAction); menuManager.add(fInvertColorsAction); menuManager.add(fAutoTerminateAction); menuManager.add(fShowPreferencePageAction); }

Target:
protected void contextMenuAboutToShow(IMenuManager menuManager) { menuManager.add(fCopyAction); menuManager.add(fPasteAction); menuManager.add(fSelectAllAction); menuManager.add(new Separator()); menuManager.add(fClearAction); menuManager.add(new Separator()); menuManager.add(fScrollLockAction); menuManager.add(new Separator()); menuManager.add(fTerminateLaunchAction); menuManager.add(fInvertColorsAction); menuManager.add(fAutoTerminateAction); menuManager.add(new Separator()); menuManager.add(fShowPreferencePageAction); }
Source:
public WeldSEClassFileInfo(String className, IndexView index, LoadingCache<DotName, Set<String>> annotationClassAnnotationsCache, ClassLoader classLoader) { this.index = index; this.annotationClassAnnotationsCache = annotationClassAnnotationsCache; this.classInfo = index.getClassByName(DotName.createSimple(className)); if (this.classInfo == null) { throw new IllegalStateException(("Index for name:" + className + "not found")); } this.isVetoed = isVetoedTypeOrPackage(); this.hasCdiConstructor = this.classInfo.hasNoArgsConstructor() || hasInjectConstructor(); this.classLoader = classLoader; }

Target:
public WeldSEClassFileInfo(String className, IndexView index, LoadingCache<DotName, Set<String>> annotationClassAnnotationsCache, ClassLoader classLoader) { this.index = index; this.annotationClassAnnotationsCache = annotationClassAnnotationsCache; this.classInfo = index.getClassByName(DotName.createSimple(className)); if (this.classInfo == null) { throw new IllegalStateException("Index for name: " + className + " not found"); } this.isVetoed = isVetoedTypeOrPackage(); this.hasCdiConstructor = this.classInfo.hasNoArgsConstructor() || hasInjectConstructor(); this.classLoader = classLoader; }
Source:
private void scheduleTasksCleanupForWorker(final String worker, final List<String> tasksToFail) { removedWorkerCleanups.put( worker, exec.schedule( new Runnable() { @Override public void run() { log.info("Running scheduled cleanup for Worker[%s]", worker); for (String assignedTask : tasksToFail) { String taskPath = JOINER.join(indexerZkConfig.getTasksPath(), worker, assignedTask); String statusPath = JOINER.join(indexerZkConfig.getStatusPath(), worker, assignedTask); try { if (cf.checkExists().forPath(taskPath) != null) { cf.delete().guaranteed().forPath(taskPath); } if (cf.checkExists().forPath(statusPath) != null) { cf.delete().guaranteed().forPath(statusPath); } } catch (Exception e) { throw Throwables.propagate(e); } log.info("Failing task[%s]", assignedTask); RemoteTaskRunnerWorkItem taskRunnerWorkItem = runningTasks.remove(assignedTask); if (taskRunnerWorkItem != null) { taskRunnerWorkItem.setResult(TaskStatus.failure(taskRunnerWorkItem.getTaskId())); } else { log.warn("RemoteTaskRunner has no knowledge of task[%s]", assignedTask); } } } }, config.getTaskCleanupTimeout().toStandardDuration().getMillis(), TimeUnit.MILLISECONDS ) ); }

Target:
private void scheduleTasksCleanupForWorker(final String worker, final List<String> tasksToFail) { removedWorkerCleanups.put( worker, cleanupExec.schedule( new Runnable() { @Override public void run() { log.info("Running scheduled cleanup for Worker[%s]", worker); try { for (String assignedTask : tasksToFail) { String taskPath = JOINER.join(indexerZkConfig.getTasksPath(), worker, assignedTask); String statusPath = JOINER.join(indexerZkConfig.getStatusPath(), worker, assignedTask); try { if (cf.checkExists().forPath(taskPath) != null) { cf.delete().guaranteed().forPath(taskPath); } if (cf.checkExists().forPath(statusPath) != null) { cf.delete().guaranteed().forPath(statusPath); } } catch (Exception e) { throw Throwables.propagate(e); } log.info("Failing task[%s]", assignedTask); RemoteTaskRunnerWorkItem taskRunnerWorkItem = runningTasks.remove(assignedTask); if (taskRunnerWorkItem != null) { taskRunnerWorkItem.setResult(TaskStatus.failure(taskRunnerWorkItem.getTaskId())); } else { log.warn("RemoteTaskRunner has no knowledge of task[%s]", assignedTask); } } } finally { removedWorkerCleanups.remove(worker); } } }, config.getTaskCleanupTimeout().toStandardDuration().getMillis(), TimeUnit.MILLISECONDS ) ); }
Source:
public List<MetricFamilySamples> collect() { List<MetricFamilySamples.Sample> samples = new ArrayList<MetricFamilySamples.Sample>(); for(Map.Entry<List<String>, Child> c: children.entrySet()) { Child.Value v = c.getValue().get(); List<String> labelNamesWithQuantile = new ArrayList<String>(labelNames); labelNamesWithQuantile.add("quantile"); for (CKMSQuantiles.Quantile q : this.quantiles) { List<String> labelValuesWithQuantile = new ArrayList<String>(c.getKey()); labelValuesWithQuantile.add(doubleToGoString(q.quantile)); samples.add(new MetricFamilySamples.Sample(fullname, labelNamesWithQuantile, labelValuesWithQuantile, v.quantiles.get(q.quantile))); } samples.add(new MetricFamilySamples.Sample(fullname + "_count", labelNames, c.getKey(), v.count)); samples.add(new MetricFamilySamples.Sample(fullname + "_sum", labelNames, c.getKey(), v.sum)); } MetricFamilySamples mfs = new MetricFamilySamples(fullname, Type.SUMMARY, help, samples); List<MetricFamilySamples> mfsList = new ArrayList<MetricFamilySamples>(); mfsList.add(mfs); return mfsList; }

Target:
public List<MetricFamilySamples> collect() { List<MetricFamilySamples.Sample> samples = new ArrayList<MetricFamilySamples.Sample>(); for(Map.Entry<List<String>, Child> c: children.entrySet()) { Child.Value v = c.getValue().get(); List<String> labelNamesWithQuantile = new ArrayList<String>(labelNames); labelNamesWithQuantile.add("quantile"); for(Map.Entry<Double, Double> q : v.quantiles.entrySet()) { List<String> labelValuesWithQuantile = new ArrayList<String>(c.getKey()); labelValuesWithQuantile.add(doubleToGoString(q.getKey())); samples.add(new MetricFamilySamples.Sample(fullname, labelNamesWithQuantile, labelValuesWithQuantile, q.getValue())); } samples.add(new MetricFamilySamples.Sample(fullname + "_count", labelNames, c.getKey(), v.count)); samples.add(new MetricFamilySamples.Sample(fullname + "_sum", labelNames, c.getKey(), v.sum)); } MetricFamilySamples mfs = new MetricFamilySamples(fullname, Type.SUMMARY, help, samples); List<MetricFamilySamples> mfsList = new ArrayList<MetricFamilySamples>(); mfsList.add(mfs); return mfsList; }
Source:
private void initHandler() { mHandler = ViewModelProviders.of(this).get(EmailLinkEmailHandler.class); mHandler.init(getFlowParams()); mHandler.getOperation().observe(this, new ResourceObserver<String>(this, R.string .fui_progress_dialog_sending) { @Override protected void onSuccess(@NonNull String email) { } @Override protected void onFailure(@NonNull Exception e) { mListener.onSendEmailFailure(); } }); }

Target:
private void initHandler() { mEmailLinkSendEmailHandler = ViewModelProviders.of(this).get(EmailLinkSendEmailHandler .class); mEmailLinkSendEmailHandler.init(getFlowParams()); mEmailLinkSendEmailHandler.getOperation().observe(this, new ResourceObserver<String>(this, R.string.fui_progress_dialog_sending) { @Override protected void onSuccess(@NonNull String email) { Log.w(TAG, "Email for email link sign in sent successfully."); doAfterTimeout(new Runnable() { @Override public void run() { mTopLevelView.setVisibility(View.VISIBLE); } }); } @Override protected void onFailure(@NonNull Exception e) { mListener.onSendEmailFailure(e); } }); }
Source:
private void updateButtonSpacing() { Resources res = getContext().getResources(); int buttonOffset = res.getDimensionPixelSize(R.dimen.car_padding_4) - res.getDimensionPixelSize(R.dimen.car_padding_2); ViewGroup.MarginLayoutParams positiveButtonLayoutParams = (ViewGroup.MarginLayoutParams) mPositiveButton.getLayoutParams(); ViewGroup.MarginLayoutParams negativeButtonLayoutParams = (ViewGroup.MarginLayoutParams) mNegativeButton.getLayoutParams(); if ((mPositiveButton.getVisibility() == View.VISIBLE && mNegativeButton.getVisibility() == View.VISIBLE)) { positiveButtonLayoutParams.setMarginStart(buttonOffset); positiveButtonLayoutParams.setMarginEnd(mButtonSpacing); mPositiveButton.requestLayout(); negativeButtonLayoutParams.setMarginStart(mButtonSpacing); mNegativeButton.requestLayout(); } else if (mPositiveButton.getVisibility() == View.VISIBLE) { positiveButtonLayoutParams.setMarginStart(buttonOffset); mPositiveButton.requestLayout(); } else if (mNegativeButton.getVisibility() == View.VISIBLE) { negativeButtonLayoutParams.setMarginStart(buttonOffset); mNegativeButton.requestLayout(); } }

Target:
private void updateButtonSpacing() { Resources res = getContext().getResources(); int buttonOffset = mBottomPadding - mButtonSpacing; ViewGroup.MarginLayoutParams positiveButtonLayoutParams = (ViewGroup.MarginLayoutParams) mPositiveButton.getLayoutParams(); ViewGroup.MarginLayoutParams negativeButtonLayoutParams = (ViewGroup.MarginLayoutParams) mNegativeButton.getLayoutParams(); if ((mPositiveButton.getVisibility() == View.VISIBLE && mNegativeButton.getVisibility() == View.VISIBLE)) { positiveButtonLayoutParams.setMarginStart(buttonOffset); positiveButtonLayoutParams.setMarginEnd(mButtonSpacing); mPositiveButton.requestLayout(); negativeButtonLayoutParams.setMarginStart(mButtonSpacing); mNegativeButton.requestLayout(); } else if (mPositiveButton.getVisibility() == View.VISIBLE) { positiveButtonLayoutParams.setMarginStart(buttonOffset); mPositiveButton.requestLayout(); } else if (mNegativeButton.getVisibility() == View.VISIBLE) { negativeButtonLayoutParams.setMarginStart(buttonOffset); mNegativeButton.requestLayout(); } }
Source:
public void startMetrics() { for (MetricsReporter reporter:reporters.values()) { reporter.register("samza-container-" + processorId, metrics.getMetricsRegistry()); reporter.start(); } }

Target:
private void startMetrics() { for (MetricsReporter reporter: reporters.values()) { reporter.register("job-coordinator-" + processorId, (ReadableMetricsRegistry) metrics.getMetricsRegistry()); reporter.start(); } }
Source:
public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) { case 0: return rangesTab.get(rowIndex).getColor(); case 1: return rangesTab.get(rowIndex).getAlias(); default: return null; } }

Target:
public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) { case 0: return rangesTab.get(rowIndex).getColor(); case 1: return rangesTab.get(rowIndex).getAlias(); default: throw new ArrayIndexOutOfBoundsException(); } }
Source:
public YouTubeAccessControl deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { YouTubeAccessControl accessControl = new YouTubeAccessControl(); JsonObject jsonObject = json.getAsJsonObject(); if (jsonObject.has("autoPlay")) { accessControl.setAutoPlay(getPermission(jsonObject.get("autoPlay") .getAsString())); } if (jsonObject.has("comment")) { accessControl.setAutoPlay(getPermission(jsonObject.get("comment") .getAsString())); } if (jsonObject.has("commentVote")) { accessControl.setAutoPlay(getPermission(jsonObject.get( "commentVote").getAsString())); } if (jsonObject.has("videoRespond")) { accessControl.setAutoPlay(getPermission(jsonObject.get( "videoRespond").getAsString())); } if (jsonObject.has("rate")) { accessControl.setAutoPlay(getPermission(jsonObject.get("rate") .getAsString())); } if (jsonObject.has("embed")) { accessControl.setAutoPlay(getPermission(jsonObject.get("embed") .getAsString())); } if (jsonObject.has("list")) { accessControl.setAutoPlay(getPermission(jsonObject.get("list") .getAsString())); } if (jsonObject.has("syndicate")) { accessControl.setAutoPlay(getPermission(jsonObject.get("syndicate") .getAsString())); } return accessControl; }

Target:
public YouTubeAccessControl deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { YouTubeAccessControl accessControl = new YouTubeAccessControl(); return accessControl; }
Source:
public long saveBox(Box box) throws IOException { if (boxStore != null) { if (box.getId() == AbstractBox.UNSAVED_ID) { try { boxStore.save(box); if (autoGenerateIdentificationBarcodes) { box.setIdentificationBarcode(box.getName() + "::" + box.getAlias()); } namingScheme.generateNameFor(box); validateNameOrThrow(box, namingScheme); return boxStore.save(box); } catch (MisoNamingException e) { throw new IOException("Invalid name for box", e); } } else { Box original = boxStore.get(box.getId()); original.setAlias(box.getAlias()); original.setDescription(box.getDescription()); original.setIdentificationBarcode(box.getIdentificationBarcode()); original.setSize(boxStore.getSizeById(box.getSize().getId())); original.setUse(boxStore.getUseById(box.getUse().getId())); Map<String, Boxable> contents = new HashMap<>(); for (Map.Entry<String, Boxable> entry : box.getBoxables().entrySet()) { saveBoxElement(contents, entry); } original.setBoxables(contents); return boxStore.save(box); } } else { throw new IOException("No boxStore available. Check that it has been declared in the Spring config."); } }

Target:
public long saveBox(Box box) throws IOException { if (boxStore != null) { return boxStore.save(box); } else { throw new IOException("No boxStore available. Check that it has been declared in the Spring config."); } }
Source:
public OptimalAssignment calculate(ClusterModel clusterModel) throws HelixRebalanceException { OptimalAssignment optimalAssignment = new OptimalAssignment(); Map<String, Set<AssignableReplica>> replicasByResource = clusterModel.getAssignableReplicaMap(); List<AssignableNode> nodes = new ArrayList<>(clusterModel.getAssignableNodes().values()); List<AssignableReplica> orderedAssignableReplicas = replicasByResource.values().stream().flatMap(replicas -> replicas.stream()) .collect(Collectors.toList()); orderedAssignableReplicas.sort((o1, o2) -> { int priority1 = o1.getStatePriority(); int priority2 = o2.getStatePriority(); if (priority1 == priority2) { return o1.getPartitionName().compareTo(o2.getPartitionName()); } else { return priority1 - priority2; } }); for (AssignableReplica replica : orderedAssignableReplicas) { Optional<AssignableNode> maybeBestNode = getNodeWithHighestPoints(replica, nodes, clusterModel.getContext(), optimalAssignment); if (optimalAssignment.hasAnyFailure()) { String errorMessage = String.format( "Unable to find any available candidate node for partition %s; Fail reasons: %s", replica.getPartitionName(), optimalAssignment.getFailures()); throw new HelixRebalanceException(errorMessage, HelixRebalanceException.Type.FAILED_TO_CALCULATE); } maybeBestNode.ifPresent(node -> clusterModel .assign(replica.getResourceName(), replica.getPartitionName(), replica.getReplicaState(), node.getInstanceName())); } optimalAssignment.updateAssignments(clusterModel); return optimalAssignment; }

Target:
public OptimalAssignment calculate(ClusterModel clusterModel) throws HelixRebalanceException { OptimalAssignment optimalAssignment = new OptimalAssignment(); List<AssignableNode> nodes = new ArrayList<>(clusterModel.getAssignableNodes().values()); for (AssignableReplica replica : getOrderedAssignableReplica(clusterModel)) { Optional<AssignableNode> maybeBestNode = getNodeWithHighestPoints(replica, nodes, clusterModel.getContext(), optimalAssignment); if (optimalAssignment.hasAnyFailure()) { String errorMessage = String.format( "Unable to find any available candidate node for partition %s; Fail reasons: %s", replica.getPartitionName(), optimalAssignment.getFailures()); throw new HelixRebalanceException(errorMessage, HelixRebalanceException.Type.FAILED_TO_CALCULATE); } maybeBestNode.ifPresent(node -> clusterModel .assign(replica.getResourceName(), replica.getPartitionName(), replica.getReplicaState(), node.getInstanceName())); } optimalAssignment.updateAssignments(clusterModel); return optimalAssignment; }
Source:
abstract void serve() throws Exception; abstract void serve(Writer out) throws Exception; public final String eval() { StringWriter out = new StringWriter(4096); try { serve(out); } catch (Exception e) { throw new DotRuntimeException(e); } return out.toString(); }

Target:
abstract void serve() throws DotDataException, IOException, DotSecurityException; abstract void serve(Writer out) throws DotDataException, IOException, DotSecurityException; public final String eval() { StringWriter out = new StringWriter(4096); try { serve(out); } catch (DotDataException | IOException | DotSecurityException e) { throw new DotRuntimeException(e); } return out.toString(); }
Source:
private static boolean isFailureToWrite( ClientException e ) { return e.code().equals( "Neo.ClientError.Cluster.NotALeader" ) || e.code().equals( "Neo.ClientError.General.ForbiddenOnReadOnlyDatabase" ); }

Target:
private static boolean isFailureToWrite( ClientException e ) { String errorCode = e.code(); return Objects.equals( errorCode, "Neo.ClientError.Cluster.NotALeader" ) || Objects.equals( errorCode, "Neo.ClientError.General.ForbiddenOnReadOnlyDatabase" ); }
Source:
public BuildPlan getPlanById(List<IBuildPlan> plans, String id) { if (id != null) { for (IBuildPlan plan : plans) { if (id.equals(plan.getId())) { return (BuildPlan) plan; } for (IBuildPlan childPlan : plan.getChildren()) { if (id.equals(childPlan.getId())) { return (BuildPlan) childPlan; } } } } return null; }

Target:
public BuildPlan getPlanById(List<IBuildPlan> plans, String id) { if (plans != null && id != null) { for (IBuildPlan plan : plans) { if (id.equals(plan.getId())) { return (BuildPlan) plan; } BuildPlan maybePlan = getPlanById(plan.getChildren(), id); if (maybePlan != null) { return maybePlan; } } } return null; }
Source:
public void sendRequest() throws Exception { URLConnection connection = new URL("http://localhost:8181/cxf/HelloWorldSecurity") .openConnection(); connection.setDoInput(true); connection.setDoOutput(true); OutputStream os = connection.getOutputStream(); InputStream fis = getClass().getClassLoader().getResourceAsStream("org/apache/camel/example/cxf/ws/request.xml"); System.out.println(fis.toString()); IOUtils.copy(fis, os); InputStream is = connection.getInputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); IOUtils.copy(is, baos); System.out.println("the response is =====>"); System.out.println(baos.toString()); }

Target:
public void sendRequest() throws Exception { URLConnection connection = new URL("http://localhost:8181/cxf/HelloWorldSecurity") .openConnection(); connection.setDoInput(true); connection.setDoOutput(true); OutputStream os = connection.getOutputStream(); InputStream fis = getClass().getClassLoader().getResourceAsStream("org/apache/camel/example/cxf/ws/request.xml"); IOUtils.copy(fis, os); InputStream is = connection.getInputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); IOUtils.copy(is, baos); System.out.println(baos.toString()); }
Source:
private Constraint coachStopLimit(ConstraintFactory constraintFactory) { return constraintFactory.from(BusStop.class) .filter(busStop -> busStop.getBus() instanceof Coach) .groupBy(busStop -> (Coach) busStop.getBus(), count()) .filter((coach, stopCount) -> stopCount > coach.getStopLimit()) .penalizeLong("coachStopLimit", HardSoftLongScore.ofUninitialized(0, 1000000, 0), (coach, stopCount) -> stopCount - coach.getStopLimit()); }

Target:
private Constraint coachStopLimit(ConstraintFactory constraintFactory) { return constraintFactory.from(BusStop.class) .filter(busStop -> busStop.getBus() instanceof Coach) .groupBy(busStop -> (Coach) busStop.getBus(), count()) .filter((coach, stopCount) -> stopCount > coach.getStopLimit()) .penalizeLong("coachStopLimit", HardSoftLongScore.ofHard(1000_000), (coach, stopCount) -> stopCount - coach.getStopLimit()); }
Source:
private void unzip(File dir, File zipFile) throws IOException { dir = dir.getAbsoluteFile(); ZipFile zip = new ZipFile(zipFile); @SuppressWarnings("unchecked") Enumeration<ZipEntry> entries = zip.getEntries(); try { while (entries.hasMoreElements()) { ZipEntry e = entries.nextElement(); File f = new File(dir, e.getName()); if (e.isDirectory()) { Files.createDirectories(f.toPath()); } else { File p = f.getParentFile(); if (p != null) { Files.createDirectories(p.toPath()); } try (InputStream input = zip.getInputStream(e)) { IOUtils.copy(input, writing(f)); } try { FilePath target = new FilePath(f); int mode = e.getUnixMode(); if (mode!=0) target.chmod(mode); } catch (InterruptedException ex) { LOGGER.log(Level.WARNING, "unable to set permissions", ex); } f.setLastModified(e.getTime()); } } } finally { zip.close(); } }

Target:
private void unzip(File dir, File zipFile) throws IOException { dir = dir.getAbsoluteFile(); ZipFile zip = new ZipFile(zipFile); @SuppressWarnings("unchecked") Enumeration<ZipEntry> entries = zip.getEntries(); try { while (entries.hasMoreElements()) { ZipEntry e = entries.nextElement(); File f = new File(dir, e.getName()); if (e.isDirectory()) { mkdirs(f); } else { File p = f.getParentFile(); if (p != null) { mkdirs(p); } try (InputStream input = zip.getInputStream(e)) { IOUtils.copy(input, writing(f)); } try { FilePath target = new FilePath(f); int mode = e.getUnixMode(); if (mode!=0) target.chmod(mode); } catch (InterruptedException ex) { LOGGER.log(Level.WARNING, "unable to set permissions", ex); } f.setLastModified(e.getTime()); } } } finally { zip.close(); } }
Source:
public TraceEventHandlerExecutionGraph(LttngKernelExecGraphProvider provider) { super(provider); fKernel = NonNullUtils.checkNotNull(HashBasedTable.<@NonNull String, @NonNull Integer, @NonNull LttngWorker> create()); fTcpNodes = new HashMap<>(); fMatchProcessing = new IMatchProcessingUnit() { @Override public void matchingEnded() { } @Override public int countMatches() { return 0; } @Override public void addMatch(@Nullable TmfEventDependency match) { if (match == null) { return; } @Nullable TmfVertex output = fTcpNodes.remove(match.getSourceEvent()); @Nullable TmfVertex input = fTcpNodes.remove(match.getDestinationEvent()); if (output != null && input != null) { output.linkVertical(input).setType(EdgeType.NETWORK); } } @Override public void init(Collection<ITmfTrace> fTraces) { } }; ITmfTrace trace = provider.getTrace(); fTcpMatching = new TmfEventMatching(Collections.singleton(trace), fMatchProcessing); fTcpMatching.initMatching(); }

Target:
public TraceEventHandlerExecutionGraph(LttngKernelExecGraphProvider provider) { super(provider); fKernel = NonNullUtils.checkNotNull(HashBasedTable.create()); fTcpNodes = new HashMap<>(); fMatchProcessing = new IMatchProcessingUnit() { @Override public void matchingEnded() { } @Override public int countMatches() { return 0; } @Override public void addMatch(@Nullable TmfEventDependency match) { if (match == null) { return; } TmfVertex output = fTcpNodes.remove(match.getSourceEvent()); TmfVertex input = fTcpNodes.remove(match.getDestinationEvent()); if (output != null && input != null) { output.linkVertical(input).setType(EdgeType.NETWORK); } } @Override public void init(Collection<ITmfTrace> fTraces) { } }; ITmfTrace trace = provider.getTrace(); fTcpMatching = new TmfEventMatching(Collections.singleton(trace), fMatchProcessing); fTcpMatching.initMatching(); }
Source:
private String getActualColumnName(String tableNameWithType, String columnName) { String[] splits = StringUtils.split(columnName, ".", 2); if (_enableCaseInsensitive) { if (splits.length == 2) { if (tableNameWithType.equalsIgnoreCase(splits[0]) || TableNameBuilder.extractRawTableName(tableNameWithType) .equalsIgnoreCase(splits[0])) { return _tableCache.getActualColumnName(tableNameWithType, splits[1]); } } return _tableCache.getActualColumnName(tableNameWithType, columnName); } else { if (splits.length == 2) { if (tableNameWithType.equals(splits[0]) || TableNameBuilder.extractRawTableName(tableNameWithType) .equals(splits[0])) { return splits[1]; } } } return columnName; }

Target:
private String getActualColumnName(String tableNameWithType, String columnName) { String[] splits = StringUtils.split(columnName, ".", 2); if (_enableCaseInsensitive) { if (splits.length == 2) { if (TableNameBuilder.extractRawTableName(tableNameWithType).equalsIgnoreCase(splits[0])) { return _tableCache.getActualColumnName(tableNameWithType, splits[1]); } } return _tableCache.getActualColumnName(tableNameWithType, columnName); } else { if (splits.length == 2) { if (TableNameBuilder.extractRawTableName(tableNameWithType).equals(splits[0])) { return splits[1]; } } } return columnName; }
Source:
public RabbitTemplate rabbitTemplate(ConnectionFactory rabbitConnectionFactory) { RabbitTemplate rabbitTemplate = new RabbitTemplate(rabbitConnectionFactory); String converterBeanName = this.properties.getConverterBeanName(); if (StringUtils.hasText(converterBeanName)) { if (RabbitSinkProperties.JSON_CONVERTER.equals(converterBeanName)) { rabbitTemplate.setMessageConverter(jsonConverter()); } else { rabbitTemplate.setMessageConverter(this.context.getBean(converterBeanName, MessageConverter.class)); } } return rabbitTemplate; }

Target:
public RabbitTemplate rabbitTemplate(ConnectionFactory rabbitConnectionFactory) { RabbitTemplate rabbitTemplate = new RabbitTemplate(rabbitConnectionFactory); if (this.messageConverter != null) { rabbitTemplate.setMessageConverter(this.messageConverter); } return rabbitTemplate; }
Source:
public void metricsText( @Suspended final AsyncResponse response, @QueryParam("group") String group, @Context final HttpServletRequest servletReq, final String query ) { final HttpContext httpContext = CoreHttpContextFactory.create(servletReq); final QueryContext queryContext = QueryContextFactory.create(Optional.empty()); queryLogger.logHttpQueryText(queryContext, query, httpContext); final Query q = this.query.newQueryFromString(query).build(); final QueryManager.Group g = this.query.useOptionalGroup(Optional.ofNullable(group)); final AsyncFuture<QueryResult> callback = g.query(q, queryContext); bindMetricsResponse(response, callback, queryContext); }

Target:
public void metricsText( @Suspended final AsyncResponse response, @QueryParam("group") String group, @Context final HttpServletRequest servletReq, final String query ) { final HttpContext httpContext = CoreHttpContextFactory.create(servletReq); final QueryContext queryContext = QueryContext.empty(); queryLogger.logHttpQueryText(queryContext, query, httpContext); final Query q = this.query.newQueryFromString(query).build(); final QueryManager.Group g = this.query.useOptionalGroup(Optional.ofNullable(group)); final AsyncFuture<QueryResult> callback = g.query(q, queryContext); bindMetricsResponse(response, callback, queryContext); }
Source:
public void run() { _logHandler.setUpContext(_process, _context); while (_running) { try { ShellMsg shellMsg = _process.readShellMsg(); String command = shellMsg.getCommand(); if (command == null) { throw new IllegalArgumentException("Command not found in bolt message: " + shellMsg); } setHeartbeat(); switch (command) { case "ack": handleAck(shellMsg.getId()); break; case "fail": handleFail(shellMsg.getId()); break; case "error": handleError(shellMsg.getMsg()); break; case "log": _logHandler.log(shellMsg); break; case "emit": handleEmit(shellMsg); break; case "metrics": handleMetrics(shellMsg); break; } } catch (InterruptedException e) { } catch (Throwable t) { die(t); } } }

Target:
public void run() { while (_running) { try { ShellMsg shellMsg = _process.readShellMsg(); String command = shellMsg.getCommand(); if (command == null) { throw new IllegalArgumentException("Command not found in bolt message: " + shellMsg); } setHeartbeat(); switch (command) { case "ack": handleAck(shellMsg.getId()); break; case "fail": handleFail(shellMsg.getId()); break; case "error": handleError(shellMsg.getMsg()); break; case "log": _logHandler.log(shellMsg); break; case "emit": handleEmit(shellMsg); break; case "metrics": handleMetrics(shellMsg); break; } } catch (InterruptedException e) { } catch (Throwable t) { die(t); } } }
Source:
public Supplier<PrimitiveService> serviceFactory() { return null; }

Target:
public Supplier<PrimitiveService> serviceFactory() { throw new UnsupportedOperationException(); }
Source:
public static boolean isSystemDarkTheme () { boolean isDarkTheme = false; if (OS.WIN32_VERSION >= OS.VERSION (10, 0)) { TCHAR key = new TCHAR (0, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", true); long phkResult = new long [1]; boolean regKeyFound = false; if (OS.RegOpenKeyEx(OS.HKEY_CURRENT_USER, key, 0, OS.KEY_READ, phkResult) == 0) { regKeyFound = true; } else if (OS.RegOpenKeyEx(OS.HKEY_LOCAL_MACHINE, key, 0, OS.KEY_READ, phkResult) == 0) { regKeyFound = true; } if (regKeyFound) { int lpcbData = new int [1]; TCHAR buffer = new TCHAR (0, "AppsUseLightTheme", true); int result = OS.RegQueryValueEx (phkResult [0], buffer, 0, null, (TCHAR)null, lpcbData); if (result == 0) { int[] lpData = new int[1]; result = OS.RegQueryValueEx(phkResult[0], buffer, 0, null, lpData, lpcbData); if (result == 0) { isDarkTheme = (lpData[0] == 0); } } OS.RegCloseKey (phkResult [0]); } } return isDarkTheme; }

Target:
public static boolean isSystemDarkTheme () { boolean isDarkTheme = false; if (OS.WIN32_VERSION >= OS.VERSION (10, 0)) { TCHAR key = new TCHAR (0, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", true); long phkResult = new long [1]; if (OS.RegOpenKeyEx(OS.HKEY_CURRENT_USER, key, 0, OS.KEY_READ, phkResult) == 0) { int[] lpcbData = new int[] { 4 }; TCHAR buffer = new TCHAR(0, "AppsUseLightTheme", true); int[] lpData = new int[1]; int result = OS.RegQueryValueEx(phkResult[0], buffer, 0, null, lpData, lpcbData); if (result == 0) { isDarkTheme = (lpData[0] == 0); } OS.RegCloseKey(phkResult[0]); } } return isDarkTheme; }
Source:
private void checkFieldType(String fieldName, long columnIndex, RealmFieldType expectedType) { RealmFieldType columnType = proxyState.getRow$realm().getColumnType(columnIndex); if (columnType != RealmFieldType.BOOLEAN) { String indefiniteWowel = ""; if (expectedType == RealmFieldType.INTEGER || expectedType == RealmFieldType.LIST) { indefiniteWowel = "n"; } throw new IllegalArgumentException(String.format("'%s' is not a%s '%s', but a%s '%s'.", fieldName, indefiniteWowel, expectedType, indefiniteWowel, columnType)); } }

Target:
private void checkFieldType(String fieldName, long columnIndex, RealmFieldType expectedType) { RealmFieldType columnType = proxyState.getRow$realm().getColumnType(columnIndex); if (columnType != expectedType) { String indefiniteVowel = ""; if (expectedType == RealmFieldType.INTEGER || expectedType == RealmFieldType.LIST) { indefiniteVowel = "n"; } throw new IllegalArgumentException(String.format("'%s' is not a%s '%s', but a%s '%s'.", fieldName, indefiniteVowel, expectedType, indefiniteVowel, columnType)); } }
Source:
public boolean isAllowedContents(Object object) { boolean result = false; if (object instanceof Property) { final Property prop = (Property) object; Element owner = prop.getOwner(); result = owner instanceof Stereotype; if (result) { result = false; while(owner.getOwner() instanceof Package && !result){ result = owner.getOwner() instanceof Profile; owner = owner.getOwner(); } if (result) { result = EMFHelper.isReadOnly(prop); } } } return result; }

Target:
public boolean isAllowedContents(Object object) { boolean result = false; if (object instanceof Property) { final Property prop = (Property) object; Element owner = prop.getOwner(); if (owner instanceof Stereotype) { while(owner.getOwner() instanceof Package && !result){ owner = owner.getOwner(); result = owner instanceof Profile; } if (result) { result = EMFHelper.isReadOnly(prop); } } } return result; }
Source:
public String toString() { return new String(fValue) + (fIsUDLIntegral ? new String(fSuffix) : ""); }

Target:
public String toString() { return new String(getLiteral()); }
Source:
public int read(byte[] bytes, int offset, int length) throws IOException { if (length == 0) { return 0; } int count = Math.min(byteBuffer.remaining(), length); if (count == 0) { return -1; } byteBuffer.get(bytes, offset, count); return count; }

Target:
public int read(byte[] bytes, int offset, int length) throws IOException { if (bytes == null) { throw new NullPointerException(); } else if (offset < 0 || length < 0 || length > bytes.length - offset) { throw new IndexOutOfBoundsException(); } else if (length == 0) { return 0; } int count = Math.min(byteBuffer.remaining(), length); if (count == 0) { return -1; } byteBuffer.get(bytes, offset, count); return count; }
Source:
public void testUnbufferStreamStatistics() throws IOException { describe("testUnbufferStreamStatistics"); Configuration conf = createConfiguration(); S3AFileSystem fs = new S3AFileSystem(); fs.initialize(getFileSystem().getUri(), conf); FSDataInputStream inputStream = null; try { inputStream = fs.open(dest); assertEquals(0, fs.getInstrumentation().getCounterValue(STREAM_SEEK_BYTES_READ)); assertEquals(8, inputStream.read(new byte[8])); inputStream.unbuffer(); assertEquals(8, fs.getInstrumentation().getCounterValue(STREAM_SEEK_BYTES_READ)); assertEquals(4, inputStream.read(new byte[4])); inputStream.unbuffer(); assertEquals(12, fs.getInstrumentation().getCounterValue(STREAM_SEEK_BYTES_READ)); } finally { if (inputStream != null) { inputStream.close(); } } assertEquals(12, fs.getInstrumentation().getCounterValue(STREAM_SEEK_BYTES_READ)); assertNotNull(inputStream); assertEquals(12, ((S3AInputStream) inputStream.getWrappedStream()) .getS3AStreamStatistics().bytesRead); }

Target:
public void testUnbufferStreamStatistics() throws IOException { describe("testUnbufferStreamStatistics"); S3ATestUtils.MetricDiff bytesRead = new S3ATestUtils.MetricDiff( getFileSystem(), STREAM_SEEK_BYTES_READ); FSDataInputStream inputStream = null; try { inputStream = getFileSystem().open(dest); readAndAssertBytesRead(inputStream, 8); inputStream.unbuffer(); bytesRead.assertDiffEquals(8); readAndAssertBytesRead(inputStream, 4); inputStream.unbuffer(); bytesRead.assertDiffEquals(12); } finally { IOUtils.closeStream(inputStream); } bytesRead.assertDiffEquals(12); assertEquals("S3AInputStream statistics were not updated properly", 12, ((S3AInputStream) inputStream.getWrappedStream()) .getS3AStreamStatistics().bytesRead); }
Source:
public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (id) { case R.id.action_settings: return true; case android.R.id.home: this.finish(); return true; } return super.onOptionsItemSelected(item); }

Target:
public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (id) { case R.id.action_settings: return true; case android.R.id.home: this.startActivity(SharedActivityManager.createHomeJumpActivity(this)); this.finish(); return true; } return super.onOptionsItemSelected(item); }
Source:
public void invalidCollectionName() { assertThrows(RuntimeException.class, () -> subject.areCollectionsUp(Collections.singletonList("foo"))); }

Target:
public void invalidCollectionName() { assertThatExceptionOfType(RuntimeException.class).isThrownBy(() -> subject.areCollectionsUp(Collections.singletonList("foo"))); }
Source:
public void testResponseStreamCannotBeReadTwice() throws Exception { final RestResponse response = getStreamTestResponse(); try { InputStream in = response.asInputStream(); inputStreamToString(in); } catch (IOException e) { fail("The InputStream should be readable and an IOException should not have been thrown"); } try (InputStream in = response.asInputStream()) { assertNull("The InputStream should be null when trying to read it a second time", in); } catch (IOException e) { fail("An IOException should not have been thrown"); } finally { response.consumeQuietly(); } }

Target:
public void testResponseStreamCannotBeReadTwice() throws Exception { final RestResponse response = getStreamTestResponse(); try { final InputStream in = response.asInputStream(); inputStreamToString(in); } catch (IOException e) { fail("The InputStream should be readable and an IOException should not have been thrown"); } try { response.asInputStream(); fail("An IOException should have been thrown while trying to read the InputStream a second time"); } catch (IOException e) { } finally { response.consumeQuietly(); } }
Source:
protected void findLastPartition(HCatClient hcatClient, String stream) throws HCatException { List<HCatPartition> hCatPartitionList = hcatClient.getPartitions( Conduit.getHcatDBName(), getTableName(stream)); if (hCatPartitionList.isEmpty()) { LOG.info("No partitions present for " + stream + " stream. "); updateLastAddedPartitionMap(stream, (long) -1); return; } Collections.sort(hCatPartitionList, new HCatPartitionComparator()); HCatPartition lastHcatPartition = hCatPartitionList.get(hCatPartitionList.size()-1); Date lastAddedPartitionDate = getTimeStampFromHCatPartition( lastHcatPartition.getLocation(), stream); if (lastAddedPartitionDate != null) { LOG.info("Last added partition timetamp : " + lastAddedPartitionDate.getTime() + " for stream " + stream); updateLastAddedPartitionMap(stream, lastAddedPartitionDate.getTime()); } else { updateLastAddedPartitionMap(stream, (long) -1); } }

Target:
public void findLastPartition(HCatClient hcatClient, String stream) throws HCatException { String tableName = getTableName(stream); List<HCatPartition> hCatPartitionList = hcatClient.getPartitions( Conduit.getHcatDBName(), tableName); if (hCatPartitionList.isEmpty()) { LOG.info("No partitions present for " + stream + " stream. "); updateLastAddedPartitionMap(tableName, EMPTY_PARTITION_LIST); return; } Collections.sort(hCatPartitionList, new HCatPartitionComparator()); HCatPartition lastHcatPartition = hCatPartitionList.get(hCatPartitionList.size()-1); Date lastAddedPartitionDate = getTimeStampFromHCatPartition( lastHcatPartition.getLocation(), stream); if (lastAddedPartitionDate != null) { LOG.info("Last added partition timetamp : " + lastAddedPartitionDate.getTime() + " for stream " + stream); updateLastAddedPartitionMap(tableName, lastAddedPartitionDate.getTime()); } else { updateLastAddedPartitionMap(tableName, EMPTY_PARTITION_LIST); } }
Source:
public void deployStream(String name, Map<String, String> deploymentProperties) { if (deploymentProperties == null) { deploymentProperties = new HashMap<>(); } StreamDefinition streamDefinition = this.streamDefinitionRepository.findOne(name); if (streamDefinition == null) { throw new NoSuchStreamDefinitionException(name); } DeploymentState status = this.doCalculateStreamState(name); if (DeploymentState.deployed == status) { throw new StreamAlreadyDeployedException(name); } else if (DeploymentState.deploying == status) { throw new StreamAlreadyDeployingException(name); } doDeployStream(streamDefinition, deploymentProperties); final Map<String, Object> auditedData = new HashMap<>(2); auditedData.put("streamDefinitionDslText", streamDefinition.getDslText()); auditedData.put("deploymentProperties", deploymentProperties); auditRecordService.populateAndSaveAuditRecord( AuditActionType.DEPLOY, AuditOperationType.STREAM_DEFINITIONS, streamDefinition.getName(), auditedData); }

Target:
public void deployStream(String name, Map<String, String> deploymentProperties) { if (deploymentProperties == null) { deploymentProperties = new HashMap<>(); } StreamDefinition streamDefinition = this.streamDefinitionRepository.findOne(name); if (streamDefinition == null) { throw new NoSuchStreamDefinitionException(name); } DeploymentState status = this.doCalculateStreamState(name); if (DeploymentState.deployed == status) { throw new StreamAlreadyDeployedException(name); } else if (DeploymentState.deploying == status) { throw new StreamAlreadyDeployingException(name); } doDeployStream(streamDefinition, deploymentProperties); final Map<String, Object> auditedData = new HashMap<>(2); auditedData.put(STREAM_DEFINITION_DSL_TEXT, streamDefinition.getDslText()); auditedData.put(DEPLOYMENT_PROPERTIES, deploymentProperties); auditRecordService.populateAndSaveAuditRecordUsingMapData( AuditOperationType.STREAM, AuditActionType.DEPLOY, streamDefinition.getName(), auditedData); }
Source:
public static Optional<List<List<String>>> getPartitionList(Map<String, Object> properties) { List<List<String>> partitions = (List<List<String>>) properties.get(PARTITION_LIST_PROPERTY); return partitions == null ? Optional.empty() : Optional.of(ImmutableList.copyOf(partitions)); }

Target:
public static Optional<List<List<String>>> getPartitionList(Map<String, Object> properties) { List<List<String>> partitions = (List<List<String>>) properties.get(PARTITIONS_PROPERTY); return partitions == null ? Optional.empty() : Optional.of(partitions); }
Source:
protected TmfTimeRange getSignalTimeRange(ITmfTimestamp startTime) { fLock.lock(); TmfTimeRange currentRange = TmfTraceManager.getInstance().getCurrentRange(); try { long offset = fTrace == null ? 0 : currentRange.getEndTime().getDelta(currentRange.getStartTime()).normalize(0, startTime.getScale()).getValue(); TmfTimestamp initialEndOfWindow = new TmfTimestamp(startTime.getValue() + offset, startTime.getScale(), startTime.getPrecision()); return new TmfTimeRange(startTime, initialEndOfWindow); } finally { fLock.unlock(); } }

Target:
protected TmfTimeRange getSignalTimeRange(ITmfTimestamp startTime) { fLock.lock(); try { TmfTimeRange currentRange = TmfTraceManager.getInstance().getCurrentRange(); long offset = fTrace == null ? 0 : currentRange.getEndTime().getDelta(currentRange.getStartTime()).normalize(0, startTime.getScale()).getValue(); TmfTimestamp initialEndOfWindow = new TmfTimestamp(startTime.getValue() + offset, startTime.getScale(), startTime.getPrecision()); return new TmfTimeRange(startTime, initialEndOfWindow); } finally { fLock.unlock(); } }
Source:
private String getExecutionPlanName(String alertType, String queryName) { if ("Traffic".equals(alertType)) { return "Geo-ExecutionPlan-Traffic_" + queryName + "_alert"; } else { if (alertType.equals("Speed")) { return "Geo-ExecutionPlan-" + alertType + "---" + "_alert"; } return "Geo-ExecutionPlan-" + alertType + "_" + queryName + "---" + "_alert"; } }

Target:
private String getExecutionPlanName(String alertType, String queryName) { if ("Traffic".equals(alertType)) { return "Geo-ExecutionPlan-Traffic_" + queryName + "_alert"; } else { if ("Speed".equals(alertType)) { return "Geo-ExecutionPlan-" + alertType + "---" + "_alert"; } return "Geo-ExecutionPlan-" + alertType + "_" + queryName + "---" + "_alert"; } }
Source:
protected Map<String, String> getFileSystemProperties(BatchSourceContext context) { Map<String, String> properties = new HashMap<>(config.getFileSystemProperties()); if (config.shouldCopyHeader()) { properties.put(PathTrackingInputFormat.COPY_HEADER, "true"); } if (config.getFileEncoding() != null) { properties.put(PathTrackingInputFormat.SOURCE_FILE_ENCODING, config.getFileEncoding()); } return properties; }

Target:
protected Map<String, String> getFileSystemProperties(BatchSourceContext context) { Map<String, String> properties = new HashMap<>(config.getFileSystemProperties()); if (config.shouldCopyHeader()) { properties.put(PathTrackingInputFormat.COPY_HEADER, "true"); } return properties; }