auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void pollMessages() throws Exception { int count = 0; if (instances != getContext().getInstanceCount()) { instances = getContext().getInstanceCount(); DefaultKafkaConfigurer kafkaConfigurer = new DefaultKafkaConfigurer(); handleInstancesChanged(kafkaConfigurer); updateConsumerInfos(kafkaConfigurer.getTopicPartitions(), consumerInfos); } for (KafkaConsumerInfo<OFFSET> info : consumerInfos.values()) { Iterator<KafkaMessage<OFFSET>> iterator = readMessages(info); while (iterator.hasNext()) { KafkaMessage<OFFSET> message = iterator.next(); processMessage(message); info.setReadOffset(message.getNextOffset()); ++count; } } if (count > 0) { saveReadOffsets(Maps.transformValues(consumerInfos, consumerToOffset)); } }

Target:
public void pollMessages() throws Exception { if (instances != getContext().getInstanceCount()) { instances = getContext().getInstanceCount(); DefaultKafkaConfigurer kafkaConfigurer = new DefaultKafkaConfigurer(); handleInstancesChanged(kafkaConfigurer); updateConsumerInfos(kafkaConfigurer.getTopicPartitions(), consumerInfos); } int count = 0; for (KafkaConsumerInfo<OFFSET> info : consumerInfos.values()) { Iterator<KafkaMessage<OFFSET>> iterator = readMessages(info); while (iterator.hasNext()) { KafkaMessage<OFFSET> message = iterator.next(); processMessage(message); info.setReadOffset(message.getNextOffset()); ++count; } } if (count > 0) { saveReadOffsets(Maps.transformValues(consumerInfos, consumerToOffset)); } }
Source:
public void layOutGalleryDescription() { GalleryItemFragment item = getCurrentItem(); if (item == null || item.getImageTitle() == null || item.getMediaInfo() == null || item.getMediaInfo().getMetadata() == null) { infoContainer.setVisibility(View.GONE); return; } updateProgressBar(true); disposeImageCaptionDisposable(); imageCaptionDisposable = Observable.zip(MediaHelper.INSTANCE.getImageCaptions(item.getImageTitle().getPrefixedText()), ServiceFactory.get(new WikiSite(Service.COMMONS_URL)).getProtectionInfo(item.getImageTitle().getPrefixedText()), ImageTagsProvider.getImageTagsObservable(getCurrentItem().getMediaPage().pageId(), WikipediaApp.getInstance().getAppOrSystemLanguageCode()), new Function3<Map<String, String>, MwQueryResponse, Map<String, List<String>>, Boolean>() { @Override public Boolean apply(Map<String, String> captions, MwQueryResponse protectionInfoRsp, Map<String, List<String>> imageTags) throws Throwable { item.getMediaInfo().setCaptions(captions); imageTagsCount = imageTags.size(); return protectionInfoRsp.query().isEditProtected(); } }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(this::updateGalleryDescription, L::e); }

Target:
public void layOutGalleryDescription() { GalleryItemFragment item = getCurrentItem(); if (item == null || item.getImageTitle() == null || item.getMediaInfo() == null || item.getMediaInfo().getMetadata() == null) { infoContainer.setVisibility(View.GONE); return; } updateProgressBar(true); disposeImageCaptionDisposable(); imageCaptionDisposable = Observable.zip(MediaHelper.INSTANCE.getImageCaptions(item.getImageTitle().getPrefixedText()), ServiceFactory.get(new WikiSite(Service.COMMONS_URL)).getProtectionInfo(item.getImageTitle().getPrefixedText()), ImageTagsProvider.getImageTagsObservable(getCurrentItem().getMediaPage().pageId(), WikipediaApp.getInstance().getAppOrSystemLanguageCode()), (captions, protectionInfoRsp, imageTags) -> { item.getMediaInfo().setCaptions(captions); imageTagsCount = imageTags.size(); return protectionInfoRsp.query().isEditProtected(); }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(this::updateGalleryDescription, L::e); }
Source:
public String getSqlStatement() { return (logic != null ? logic.toString() + " " : "") + column.getSqlKeyword() + " " + operator.getSqlStatement(); }

Target:
public String getSqlStatement() { return (logic != null ? logic.toString() + " " : "") + "`" + column.getSqlKeyword() + "` " + operator.getSqlStatement(); }
Source:
public Single<Integer> processMetadata(String path) throws IOException { Metadata readMetadata = null; try { readMetadata = ImageMetadataReader.readMetadata(new File(path)); } catch (ImageProcessingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } if (readMetadata != null) { for (Directory directory : readMetadata.getDirectories()) { if (directory.getName().equals("Exif IFD0") || directory.getName().equals("Exif SubIFD") || directory.getName().equals("Exif Thumbnail")) { Timber.d(directory.getName() + " Contains metadata"); return Single.just(ImageUtils.IMAGE_OK); } } } return Single.just(ImageUtils.FILE_NO_EXIF); }

Target:
public Single<Integer> processMetadata(String path) { Metadata readMetadata = null; try { readMetadata = ImageMetadataReader.readMetadata(new File(path)); } catch (ImageProcessingException e) { Timber.d(e.toString()); } catch (IOException e) { Timber.d(e.toString()); } if (readMetadata != null) { for (Directory directory : readMetadata.getDirectories()) { if (directory.getName().equals("Exif IFD0") || directory.getName().equals("Exif SubIFD") || directory.getName().equals("Exif Thumbnail")) { Timber.d(directory.getName() + " Contains metadata"); return Single.just(ImageUtils.IMAGE_OK); } } } return Single.just(ImageUtils.FILE_NO_EXIF); }
Source:
@Test public void archiveBigFile() throws Exception { assumeTrue(!Functions.isWindows()); long largeFileSize = 10000000000l; File tempFile = File.createTempFile("JENKINS-10629", ".log"); RandomAccessFile file = new RandomAccessFile(tempFile, "rw"); File tarFile = new File(tempFile.getParent(), "JENKINS-10629.tar"); tarFile.deleteOnExit(); tempFile.deleteOnExit(); file.setLength(largeFileSize); assumeTrue(largeFileSize == file.length()); int tar = new FilePath(tempFile.getParentFile()).tar(new FileOutputStream(tarFile), tempFile.getName()); assertEquals("One tar file should have been compressed", 1, tar); }

Target:
@Test public void archiveBigFile() throws Exception { final long largeFileSize = 9000000000L; final String filePrefix = "JENKINS-10629"; checkTarUntarRoundTrip(filePrefix, largeFileSize); }
Source:
private static boolean isValidChallenge(String authenticateHeader, String authChallengePrefix) { if (authenticateHeader != null && !authenticateHeader.isEmpty() && authenticateHeader.toLowerCase().startsWith(authChallengePrefix.toLowerCase())) { return true; } return false; }

Target:
private static boolean isValidChallenge(String authenticateHeader, String authChallengePrefix) { return (!ImplUtils.isNullOrEmpty(authenticateHeader) && authenticateHeader.toLowerCase(Locale.ROOT).startsWith(authChallengePrefix.toLowerCase(Locale.ROOT))); }
Source:
private void testGetStudentProfile() throws Exception { StudentAttributes student1InCourse1 = dataBundle.students.get("student1InCourse1"); AccountAttributes student1 = dataBundle.accounts.get("student1InCourse1"); ______TS("success: default profile"); StudentProfileAttributes actualSpa = studentsLogic.getStudentProfile(student1InCourse1.googleId); StudentProfileAttributes expectedSpa = student1.studentProfile; expectedSpa.institute = actualSpa.institute; expectedSpa.modifiedDate = actualSpa.modifiedDate; expectedSpa.gender = actualSpa.gender; assertEquals(expectedSpa.toString(), actualSpa.toString()); ______TS("success: edited profile"); StudentProfileAttributes expectedStudentProfile = StudentProfileAttributes.builder().build(); expectedStudentProfile.googleId = student1.googleId; expectedStudentProfile.shortName = "short"; expectedStudentProfile.email = "personal@email.tmt"; expectedStudentProfile.institute = "institute"; expectedStudentProfile.nationality = "Angolan"; expectedStudentProfile.gender = Gender.FEMALE; expectedStudentProfile.moreInfo = "This sentence may sound sound but it cannot make actual sound... :P"; student1.studentProfile = expectedStudentProfile; accountsLogic.updateAccount(student1, true); StudentProfileAttributes actualStudentProfile = studentsLogic.getStudentProfile(student1InCourse1.googleId); expectedStudentProfile.modifiedDate = actualStudentProfile.modifiedDate; assertEquals(expectedStudentProfile.toString(), actualStudentProfile.toString()); }

Target:
private void testGetStudentProfile() throws Exception { StudentAttributes student1InCourse1 = dataBundle.students.get("student1InCourse1"); AccountAttributes student1 = dataBundle.accounts.get("student1InCourse1"); ______TS("success: default profile"); StudentProfileAttributes actualSpa = studentsLogic.getStudentProfile(student1InCourse1.googleId); StudentProfileAttributes expectedSpa = student1.studentProfile; expectedSpa.institute = actualSpa.institute; expectedSpa.modifiedDate = actualSpa.modifiedDate; assertEquals(expectedSpa.toString(), actualSpa.toString()); ______TS("success: edited profile"); StudentProfileAttributes expectedStudentProfile = StudentProfileAttributes.builder(student1.googleId).build(); expectedStudentProfile.shortName = "short"; expectedStudentProfile.email = "personal@email.tmt"; expectedStudentProfile.institute = "institute"; expectedStudentProfile.nationality = "Angolan"; expectedStudentProfile.gender = Gender.FEMALE; expectedStudentProfile.moreInfo = "This sentence may sound sound but it cannot make actual sound... :P"; student1.studentProfile = expectedStudentProfile; accountsLogic.updateAccount(student1, true); StudentProfileAttributes actualStudentProfile = studentsLogic.getStudentProfile(student1InCourse1.googleId); expectedStudentProfile.modifiedDate = actualStudentProfile.modifiedDate; assertEquals(expectedStudentProfile.toString(), actualStudentProfile.toString()); }
Source:
private String parseFunctionClose() throws ParseException { int index = nextNonBlank(); if (index < 0 || expression.charAt(index) != ')') { throw new ParseException(errorMessage(FUNCTION_CALL_NOT_CLOSED_PROPERLY_ERROR, functionName), parseIndex); } setParseIndex(index + 1); return ")"; }

Target:
private void parseFunctionClose() throws ParseException { int index = nextNonBlank(); if (index < 0 || expression.charAt(index) != ')') { throw new ParseException(errorMessage(FUNCTION_CALL_NOT_CLOSED_PROPERLY_ERROR, functionName), parseIndex); } setParseIndex(index + 1); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ApiDataPoint that = (ApiDataPoint) o; return id.equals(that.id); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ApiDataPoint that = (ApiDataPoint) o; return id.equals(that.getId()); }
Source:
private static @NonNull Intent helper_basicOSHMSOpenIntent() throws JSONException { return helper_baseHMSOpenIntent() .putExtra( "custom", new JSONObject() {{ put("i", UUID.randomUUID().toString()); }}.toString() ); }

Target:
private static @NonNull Intent helper_basicOSHMSOpenIntent() throws JSONException { return helper_baseHMSOpenIntent() .putExtra( PAYLOAD_OS_ROOT_CUSTOM, new JSONObject() {{ put(PAYLOAD_OS_NOTIFICATION_ID, UUID.randomUUID().toString()); }}.toString() ); }
Source:
public StreetVertexIndexServiceImpl(Graph graph, boolean hashGrid) { this.graph = graph; if (hashGrid) { edgeTree = new HashGridSpatialIndex<>(); transitStopTree = new HashGridSpatialIndex<>(); verticesTree = new HashGridSpatialIndex<>(); } else { edgeTree = new STRtree(); transitStopTree = new STRtree(); verticesTree = new STRtree(); } postSetup(); if (!hashGrid) { ((STRtree) edgeTree).build(); ((STRtree) transitStopTree).build(); simpleStreetSplitter = new SimpleStreetSplitter( this.graph, null, null, false, new BuilderAnnotationStore( false) ); } else { simpleStreetSplitter = new SimpleStreetSplitter( this.graph, (HashGridSpatialIndex<Edge>) edgeTree, transitStopTree, false, new BuilderAnnotationStore(false) ); } }

Target:
public StreetVertexIndexServiceImpl(Graph graph, boolean hashGrid) { this.graph = graph; if (hashGrid) { edgeTree = new HashGridSpatialIndex<>(); transitStopTree = new HashGridSpatialIndex<>(); verticesTree = new HashGridSpatialIndex<>(); } else { edgeTree = new STRtree(); transitStopTree = new STRtree(); verticesTree = new STRtree(); } postSetup(); if (!hashGrid) { ((STRtree) edgeTree).build(); ((STRtree) transitStopTree).build(); simpleStreetSplitter = new SimpleStreetSplitter( this.graph, null, null, false, new DataImportIssueStore( false) ); } else { simpleStreetSplitter = new SimpleStreetSplitter( this.graph, (HashGridSpatialIndex<Edge>) edgeTree, transitStopTree, false, new DataImportIssueStore(false) ); } }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.login_magic_link_request_screen, container, false); mRequestMagicLinkButton = (Button) view.findViewById(R.id.login_request_magic_link); mRequestMagicLinkButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mLoginListener != null) { if (!NetworkUtils.isNetworkAvailable(getActivity())) { ToastUtils.showToast(getActivity(), R.string.no_network_message, ToastUtils.Duration.LONG); return; } showMagiclinkRequestProgressDialog(); mDispatcher.dispatch(AuthenticationActionBuilder.newSendAuthEmailAction(mEmail)); } } }); view.findViewById(R.id.login_enter_password).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mLoginListener.usePasswordInstead(mEmail); } }); WPNetworkImageView avatarView = (WPNetworkImageView) view.findViewById(R.id.gravatar); avatarView.setImageUrl(GravatarUtils.gravatarFromEmail(mEmail, getContext().getResources() .getDimensionPixelSize(R.dimen.avatar_sz_login)), WPNetworkImageView.ImageType.AVATAR); return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.login_magic_link_request_screen, container, false); mRequestMagicLinkButton = (Button) view.findViewById(R.id.login_request_magic_link); mRequestMagicLinkButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mLoginListener != null) { if (NetworkUtils.checkConnection(getActivity())) { showMagicLinkRequestProgressDialog(); mDispatcher.dispatch(AuthenticationActionBuilder.newSendAuthEmailAction(mEmail)); } } } }); view.findViewById(R.id.login_enter_password).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mLoginListener != null) { mLoginListener.usePasswordInstead(mEmail); } } }); WPNetworkImageView avatarView = (WPNetworkImageView) view.findViewById(R.id.gravatar); avatarView.setImageUrl(GravatarUtils.gravatarFromEmail(mEmail, getContext().getResources() .getDimensionPixelSize(R.dimen.avatar_sz_login)), WPNetworkImageView.ImageType.AVATAR); return view; }
Source:
public long getContentLength() { return (bytes.length + 2) / 3 * 4; }

Target:
public long getContentLength() { return divideCeil(bytes.length, 3) * 4; }
Source:
public OnheapIncrementalIndex(IncrementalIndexSchema incrementalIndexSchema, boolean deserializeComplexMetrics, int maxRowCount) { super(incrementalIndexSchema, deserializeComplexMetrics); this.facts = new ConcurrentSkipListMap<>(); this.maxRowCount = maxRowCount; this.aggList = new Aggregator[maxRowCount][]; for(int i = 0; i < this.aggList.length; ++i){ this.aggList[i] = null; } }

Target:
public OnheapIncrementalIndex( IncrementalIndexSchema incrementalIndexSchema, boolean deserializeComplexMetrics, int maxRowCount ) { super(incrementalIndexSchema, deserializeComplexMetrics); this.maxRowCount = maxRowCount; }
Source:
protected ImmutableValue<ParrotVariant> constructImmutableValue(ParrotVariant value) { return ImmutableSpongeValue.cachedOf(Keys.PARROT_VARIANT, ParrotVariants.RED, value); }

Target:
protected ImmutableValue<ParrotVariant> constructImmutableValue(ParrotVariant value) { return ImmutableSpongeValue.cachedOf(this.key, ParrotVariants.RED, value); }
Source:
public QuestionWidget(Context context, FormEntryPrompt p, WidgetChangedListener w){ super(context); if(w!=null){ hasListener = false; widgetChangedListener = w; } this.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { QuestionWidget.this.acceptFocus(); } }); hasListener = (w != null); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); String question_font = settings.getString(PreferencesActivity.KEY_FONT_SIZE, Collect.DEFAULT_FONTSIZE); mQuestionFontsize = new Integer(question_font).intValue(); mAnswerFontsize = mQuestionFontsize + 2; mPrompt = p; setOrientation(LinearLayout.VERTICAL); setGravity(Gravity.TOP); setPadding(0, 7, 0, 0); mLayout = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); mLayout.setMargins(10, 0, 10, 0); addQuestionText(p); addHelpPlaceholder(p); addHintText(p); ACRAUtil.addCustomData(ACRAUtil.LAST_QUESTION_PROMPT, mPrompt.getLongText()); }

Target:
public QuestionWidget(Context context, FormEntryPrompt p, WidgetChangedListener w){ super(context); if(w!=null){ hasListener = false; widgetChangedListener = w; } this.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { QuestionWidget.this.acceptFocus(); } }); hasListener = (w != null); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); String question_font = settings.getString(PreferencesActivity.KEY_FONT_SIZE, Collect.DEFAULT_FONTSIZE); mQuestionFontsize = new Integer(question_font).intValue(); mAnswerFontsize = mQuestionFontsize + 2; mPrompt = p; setOrientation(LinearLayout.VERTICAL); setGravity(Gravity.TOP); setPadding(0, 7, 0, 0); mLayout = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); mLayout.setMargins(10, 0, 10, 0); addQuestionText(p); addHelpPlaceholder(p); addHintText(p); }
Source:
private static boolean isPossiblyOkHttpTimeoutBug(Throwable throwable) { if (throwable instanceof SocketTimeoutException) { return true; } Throwable cause = throwable.getCause(); return cause != null && isPossiblyOkHttpTimeoutBug(throwable); }

Target:
static boolean isPossiblyOkHttpTimeoutBug(Throwable throwable) { if (throwable instanceof SocketTimeoutException) { return true; } Throwable cause = throwable.getCause(); return cause != null && isPossiblyOkHttpTimeoutBug(cause); }
Source:
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { try { GoogleSignInAccount account = GoogleSignIn.getSignedInAccountFromIntent(data) .getResult(ApiException.class); setResult(createIdpResponse(account)); } catch (ApiException e) { if (e.getStatusCode() == CommonStatusCodes.INVALID_ACCOUNT) { mEmail = null; start(); } else { if (e.getStatusCode() == CommonStatusCodes.DEVELOPER_ERROR) { Log.w(TAG, "Developer error: this application is misconfigured. " + "Check your SHA1 and package name in the Firebase console."); } setResult(IdpResponse.fromError(new FirebaseUiException( ErrorCodes.PROVIDER_ERROR, "Code: " + e.getStatusCode() + ", message: " + e.getMessage()))); } } }

Target:
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { if (requestCode != RequestCodes.GOOGLE_PROVIDER) { return; } try { GoogleSignInAccount account = GoogleSignIn.getSignedInAccountFromIntent(data) .getResult(ApiException.class); setResult(Resource.forSuccess(createIdpResponse(account))); } catch (ApiException e) { if (e.getStatusCode() == CommonStatusCodes.INVALID_ACCOUNT) { mEmail = null; start(); } else if (e.getStatusCode() == GoogleSignInStatusCodes.SIGN_IN_CURRENTLY_IN_PROGRESS) { start(); } else { if (e.getStatusCode() == CommonStatusCodes.DEVELOPER_ERROR) { Log.w(TAG, "Developer error: this application is misconfigured. " + "Check your SHA1 and package name in the Firebase console."); } setResult(Resource.<IdpResponse>forFailure(new FirebaseUiException( ErrorCodes.PROVIDER_ERROR, "Code: " + e.getStatusCode() + ", message: " + e.getMessage()))); } } }
Source:
public static Block bingTilesAround( @SqlType(StandardTypes.DOUBLE) double latitude, @SqlType(StandardTypes.DOUBLE) double longitude, @SqlType(StandardTypes.INTEGER) long zoomLevel) { checkLatitude(latitude, LATITUDE_OUT_OF_RANGE); checkLongitude(longitude, LONGITUDE_OUT_OF_RANGE); checkZoomLevel(zoomLevel); Set<BingTile> tiles = latitudeLongitudeToSurroundingTiles(latitude, longitude, toIntExact(zoomLevel)); BlockBuilder blockBuilder = BIGINT.createBlockBuilder(null, toIntExact(tiles.size())); tiles.forEach(tile -> { BIGINT.writeLong(blockBuilder, tile.encode()); }); return blockBuilder.build(); }

Target:
public static Block bingTilesAround( @SqlType(StandardTypes.DOUBLE) double latitude, @SqlType(StandardTypes.DOUBLE) double longitude, @SqlType(StandardTypes.INTEGER) long zoomLevel) { checkLatitude(latitude, LATITUDE_OUT_OF_RANGE); checkLongitude(longitude, LONGITUDE_OUT_OF_RANGE); checkZoomLevel(zoomLevel); Set<BingTile> tiles = latitudeLongitudeToSurroundingTiles(latitude, longitude, toIntExact(zoomLevel)); BlockBuilder blockBuilder = BIGINT.createBlockBuilder(null, tiles.size()); tiles.forEach(tile -> BIGINT.writeLong(blockBuilder, tile.encode())); return blockBuilder.build(); }
Source:
protected WorkbenchJob doCreateRefreshJob() { WorkbenchJob job = super.doCreateRefreshJob(); job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { if (fCheckboxTreeViewer.getTree().isDisposed()) { return; } if (fIsExpandAll) { fCheckboxTreeViewer.expandAll(); fCheckboxTreeViewer.setCheckedElements(getCheckedElements()); } else { Object[] elements = fCheckboxTreeViewer.getExpandedElements(); fCheckboxTreeViewer.expandAll(); fCheckboxTreeViewer.setCheckedElements(getCheckedElements()); fCheckboxTreeViewer.collapseAll(); fCheckboxTreeViewer.setExpandedElements(elements); } } }); return job; }

Target:
protected WorkbenchJob doCreateRefreshJob() { WorkbenchJob job = super.doCreateRefreshJob(); return new WorkbenchJob("Refresh Filter") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { if (fCheckboxTreeViewer.getTree().isDisposed()) { return Status.CANCEL_STATUS; } Object[] elements = fCheckboxTreeViewer.getExpandedElements(); job.runInUIThread(monitor); Object[] elements2 = fCheckboxTreeViewer.getExpandedElements(); ArrayList<Object> list = new ArrayList<>(); for (int i = 0; i < elements.length; i++) { list.add(elements[i]); } for (int i = 0; i < elements2.length; i++) { if (!list.contains(elements2[i])) { list.add(elements2[i]); } } fCheckboxTreeViewer.setCheckedElements(getCheckedElements()); fCheckboxTreeViewer.setExpandedElements(list.toArray()); return Status.OK_STATUS; } }; }
Source:
public CatalogInfo(byte[] catalogBytes, byte[] catalogBytesHash, byte[] deploymentBytes) { if (deploymentBytes == null) { throw new IllegalArgumentException("Can't create CatalogContext with null deployment bytes."); } if (catalogBytes != null) { try { m_catalogBytes = catalogBytes; m_jarfile = new InMemoryJarfile(catalogBytes); m_catalogCRC = m_jarfile.getCRC(); } catch (Exception e) { throw new RuntimeException(e); } if (catalogBytesHash != null) { m_catalogHash = catalogBytesHash; } else { m_catalogHash = m_jarfile.getSha1Hash(); } } else { throw new IllegalArgumentException("Can't create CatalogContext with null catalog bytes."); } m_deploymentBytes = deploymentBytes; m_deploymentHash = CatalogUtil.makeDeploymentHash(deploymentBytes); m_deploymentHashForConfig = CatalogUtil.makeDeploymentHashForConfig(deploymentBytes); }

Target:
public CatalogInfo(byte[] catalogBytes, byte[] catalogBytesHash, byte[] deploymentBytes) { if (deploymentBytes == null) { throw new IllegalArgumentException("Can't create CatalogContext with null deployment bytes."); } if (catalogBytes == null) { throw new IllegalArgumentException("Can't create CatalogContext with null catalog bytes."); } try { m_catalogBytes = catalogBytes; m_jarfile = new InMemoryJarfile(catalogBytes); m_catalogCRC = m_jarfile.getCRC(); } catch (IOException e) { throw new RuntimeException(e); } if (catalogBytesHash == null) { m_catalogHash = m_jarfile.getSha1Hash(); } else { m_catalogHash = catalogBytesHash; } m_deploymentBytes = deploymentBytes; m_deploymentHash = CatalogUtil.makeDeploymentHash(deploymentBytes); m_deploymentHashForConfig = CatalogUtil.makeDeploymentHashForConfig(deploymentBytes); }
Source:
protected String process(IStatus status) { if (status instanceof HsErrPidStatus) { return ((HsErrPidStatus) status).getContent(); } return ""; }

Target:
protected String process(IStatus status) { if (status instanceof HsErrPidStatus) { return ((HsErrPidStatus) status).getContent(); } else { throw new IllegalStateException("Tried to process an incompatible status"); } }
Source:
public double getAttributeAsDouble(String key, double defaultValue) { Object x = getExtendedAttribute(key); if ( x == null ) return defaultValue; if ( x instanceof Double ) return (Double)x; return Double.parseDouble((String)x); }

Target:
public double getAttributeAsDouble(String key, double defaultValue) { Object x = getExtendedAttribute(key); if ( x == null ) return defaultValue; if ( x instanceof Double ) return (Double)x; return VCFUtils.parseVcfDouble((String) x); }
Source:
public AbstractItemDescriptor(String label, String description, int rank, String id) { super(); Assert.isNotNull(id); if (label != null) { this.label = label; } else { this.label = id; } if (description != null) { this.description = description; } else { this.description = EMPTY_STRING; } this.rank = rank; this.id = id; }

Target:
public AbstractItemDescriptor(String label, String description, int rank, String id) { super(); Preconditions.checkNotNull(id); if (label != null) { this.label = label; } else { this.label = id; } if (description != null) { this.description = description; } else { this.description = EMPTY_STRING; } this.rank = rank; this.id = id; }
Source:
public synchronized void logged(LogEntry e) { this.entry = e; logs.add(e); notifyAll(); }

Target:
public synchronized void logged(LogEntry e) { if (!testBundleLoc.equals(e.getBundle().getLocation())) { return; } this.entry = e; logs.add(e); notifyAll(); }
Source:
public Map<String, String> responseHeaders() { HttpResponse response = super.getResponse(); Map<String, String> responseHeaders = super.responseHeaders(); StringBuilder sb = new StringBuilder(); CookieStore store = response.getCookieStore(); if(store!=null) { for(Cookie cookie : store.getCookies()) { sb.append(cookie.getName() + "=" + cookie.getValue()); sb.append(";"); } } responseHeaders.put("Set-Cookie", sb.toString()); return responseHeaders; }

Target:
public Map<String, String> responseHeaders() { HttpResponse response = super.getResponse(); Map<String, String> responseHeaders = super.responseHeaders(); StringBuilder sb = new StringBuilder(); CookieStore store = response.getCookieStore(); if(responseHeaders.containsKey("Set-Cookie") && store!=null) { for(Cookie cookie : store.getCookies()) { sb.append(cookie.getName() + "=" + cookie.getValue()); sb.append(";"); } responseHeaders.put("Set-Cookie", sb.toString()); } return responseHeaders; }
Source:
public BoldStylerProvider(Font font) { this.fFont= font; }

Target:
public BoldStylerProvider(Font font) { fFont= font; }
Source:
private static String doReplace(JsonObject object, String input) { String result = input; for (Entry<String, JsonElement> entry : object.entrySet()) { String key = entry.getKey(); JsonElement jsonElement = object.get(key); if (jsonElement.isJsonPrimitive()) { String search = "${" + key + "}"; String replace = jsonElement.getAsString(); int index = result.indexOf(search); while (index > -1) { result = result.substring(0, index) + replace + result.substring(index + search.length()); index = result.indexOf(search); } } } return result; }

Target:
private static String doReplace(JsonObject object, String input) { String result = input; for (Entry<String, JsonElement> entry : object.entrySet()) { JsonElement jsonElement = entry.getValue(); if (jsonElement.isJsonPrimitive()) { String search = "${" + entry.getKey() + "}"; String replace = jsonElement.getAsString(); int index = result.indexOf(search); while (index > -1) { result = result.substring(0, index) + replace + result.substring(index + search.length()); index = result.indexOf(search); } } } return result; }
Source:
public CassandraRecordSink( CassandraSession cassandraSession, String schemaName, String tableName, List<String> columnNames, List<Type> columnTypes, boolean generateUUID) { this.cassandraSession = requireNonNull(cassandraSession, "cassandraSession"); this.columnTypes = ImmutableList.copyOf(requireNonNull(columnTypes, "columnTypes is null")); this.generateUUID = generateUUID; Insert insert = insertInto(schemaName, tableName); if (generateUUID) { insert.value("id", bindMarker()); } for (String columnName : columnNames) { insert.value(columnName, bindMarker()); } this.insert = cassandraSession.executeWithSession(s -> s.prepare(insert)); values = new ArrayList<>(columnTypes.size() + 1); }

Target:
public CassandraRecordSink( CassandraSession cassandraSession, String schemaName, String tableName, List<String> columnNames, List<Type> columnTypes, boolean generateUUID) { this.cassandraSession = requireNonNull(cassandraSession, "cassandraSession"); requireNonNull(schemaName, "schemaName is null"); requireNonNull(tableName, "tableName is null"); requireNonNull(columnNames, "columnNames is null"); this.columnTypes = ImmutableList.copyOf(requireNonNull(columnTypes, "columnTypes is null")); this.generateUUID = generateUUID; Insert insert = insertInto(schemaName, tableName); if (generateUUID) { insert.value("id", bindMarker()); } for (int i = 0; i < columnNames.size(); i++) { String columnName = columnNames.get(i); checkArgument(columnName != null, "columnName is null at position: %d", i); insert.value(columnName, bindMarker()); } this.insert = cassandraSession.prepare(insert); values = new ArrayList<>(columnTypes.size() + 1); }
Source:
public byte[] instrument(final InputStream input, final String name) throws IOException { try { return instrument(new ClassReader(input)); } catch (final IOException e) { throw instrumentError(name, e); } }

Target:
public byte[] instrument(final InputStream input, final String name) throws IOException { final byte[] bytes; try { bytes = InputStreams.readFully(input); } catch (final IOException e) { throw instrumentError(name, e); } return instrument(bytes, name); }
Source:
URI uri(final String path) { return uri(path, Collections.<String, String>emptyMap()); }

Target:
private URI uri(final String path) { return uri(path, Collections.<String, String>emptyMap()); }
Source:
public CapraExcelRow(Row row, File officeFile, DataFormatter formatter) { int rowNum = row.getRowNum(); StringBuilder rowBuilder = new StringBuilder(); rowBuilder.append("Row " + (rowNum + 1) + ": "); boolean firstCellSet = false; for (int j = 0; j < row.getLastCellNum(); j++) { Cell cell = row.getCell(j); String cellValue = formatter.formatCellValue(cell); if (!cellValue.isEmpty()) { if (!firstCellSet) { rowBuilder.append(cellValue); firstCellSet = true; } else { rowBuilder.append(cellDelimiter + cellValue); } } } if (firstCellSet) { Pattern p = Pattern.compile(replaceRegex); Matcher m = p.matcher(rowBuilder); String rowContent = (m.replaceAll(" ")).trim(); String rowUri = CapraOfficeObject.createUri(officeFile.getAbsolutePath(), rowNum); this.setData(rowContent); this.setUri(rowUri); } }

Target:
public CapraExcelRow(Row row, File officeFile, DataFormatter formatter) { int rowNum = row.getRowNum(); StringBuilder rowBuilder = new StringBuilder(); rowBuilder.append("Row " + (rowNum + 1) + ": "); boolean firstCellSet = false; for (int j = 0; j < row.getLastCellNum(); j++) { Cell cell = row.getCell(j); String cellValue = formatter.formatCellValue(cell); if (!cellValue.isEmpty()) { if (!firstCellSet) { rowBuilder.append(cellValue); firstCellSet = true; } else { rowBuilder.append(cellDelimiter + cellValue); } } } if (firstCellSet) { Pattern p = Pattern.compile(replaceRegex); Matcher m = p.matcher(rowBuilder); String rowContent = (m.replaceAll(" ")).trim(); String rowUri = CapraOfficeObject.createUri(officeFile, rowNum); this.setData(rowContent); this.setUri(rowUri); } }
Source:
public void configure(Requirement<?> requirement) { if (!(requirement instanceof CustomConfiguration<?>)) { throw new IllegalArgumentException("The requirement does not implement " + CustomConfiguration.class); } log.debug("Setting custom configuration to requirement " + requirement.getClass()); @SuppressWarnings("unchecked") CustomConfiguration<Object> customConfiguration = (CustomConfiguration<Object>) requirement; log.debug("Configuration object associated with requirement " + requirement.getClass() + " is " + customConfiguration.getConfigurationClass()); boolean configurationSet = false; for (Object configuration : this.configurations) { try { customConfiguration.setConfiguration(configuration); log.debug("Configuration successfully set"); configurationSet = true; break; } catch (ClassCastException e) { log.error("This configuration (" + configuration + ") cannot be set to " + requirement.toString()); } } if (!configurationSet) { throw new RedDeerConfigurationException("None of the given configurations " + "could have ben set as configuration of the requirement " + requirement.getClass().getName()); } }

Target:
public void configure(Requirement<?> requirement) { if (!(requirement instanceof CustomConfiguration<?>)) { throw new IllegalArgumentException("The requirement does not implement " + CustomConfiguration.class); } log.debug("Setting custom configuration to requirement " + requirement.getClass()); @SuppressWarnings("unchecked") CustomConfiguration<Object> customConfiguration = (CustomConfiguration<Object>) requirement; log.debug("Configuration object associated with requirement " + requirement.getClass() + " is " + customConfiguration.getConfigurationClass()); boolean configurationSet = false; for (Object configuration : this.configurations) { if(customConfiguration.getConfigurationClass().isAssignableFrom(configuration.getClass())){ customConfiguration.setConfiguration(configuration); log.debug("Configuration successfully set"); configurationSet = true; break; } } if (!configurationSet) { throw new RedDeerConfigurationException("None of the given configurations " + "could have ben set as configuration of the requirement " + requirement.getClass().getName()); } }
Source:
public boolean addTrackingIds(final Collection<String> trackingIds) { this.trackingIds.addAll(trackingIds); return true; }

Target:
public boolean addTrackingIds(final Collection<String> trackingIds) { return this.trackingIds.addAll(trackingIds); }
Source:
public static URLConnection open(URL url) throws IOException { Jenkins h = Jenkins.getInstanceOrNull(); final ProxyConfiguration p = h!=null ? h.proxy : null; if(p==null) return url.openConnection(); URLConnection con = url.openConnection(p.createProxy(url.getHost())); if(p.getUserName()!=null) { Authenticator.setDefault(new Authenticator() { @Override public PasswordAuthentication getPasswordAuthentication() { if (getRequestorType()!=RequestorType.PROXY) return null; return new PasswordAuthentication(p.getUserName(), p.getPassword().toCharArray()); } }); } for (URLConnectionDecorator d : URLConnectionDecorator.all()) d.decorate(con); return con; }

Target:
public static URLConnection open(URL url) throws IOException { final ProxyConfiguration p = get(); if(p==null) return url.openConnection(); URLConnection con = url.openConnection(p.createProxy(url.getHost())); if(p.getUserName()!=null) { Authenticator.setDefault(new Authenticator() { @Override public PasswordAuthentication getPasswordAuthentication() { if (getRequestorType()!=RequestorType.PROXY) return null; return new PasswordAuthentication(p.getUserName(), p.getPassword().toCharArray()); } }); } if (JenkinsJVM.isJenkinsJVM()) { decorate(con); } return con; }
Source:
public boolean configure(final StaplerRequest req, final JSONObject formData) throws FormException { try { super.configure(req, formData); this.setReportWith(formData.getString("reportWith")); this.setTargetApiURL(formData.getString("targetApiURL")); this.setTargetApiKey(formData.getString("targetApiKey")); this.setTargetHost(formData.getString("targetHost")); this.setTargetPort(formData.getInt("targetPort")); this.setHostname(formData.getString("hostname")); this.setBlacklist(formData.getString("blacklist")); this.setWhitelist(formData.getString("whitelist")); this.setGlobalTagFile(formData.getString("globalTagFile")); this.setGlobalTags(formData.getString("globalTags")); this.setGlobalJobTags(formData.getString("globalJobTags")); this.setEmitSecurityEvents(formData.getBoolean("emitSecurityEvents")); this.setEmitSystemEvents(formData.getBoolean("emitSystemEvents")); save(); ClientFactory.getClient(DatadogClient.ClientType.valueOf(this.getReportWith()), this.getTargetApiURL(), this.getTargetApiKey(), this.getTargetHost(), this.getTargetPort()); } catch(Exception e){ StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); logger.severe("Unexpected exception occurred - " + sw.toString()); } return super.configure(req, formData); }

Target:
public boolean configure(final StaplerRequest req, final JSONObject formData) throws FormException { try { super.configure(req, formData); this.setReportWith(formData.getString("reportWith")); this.setTargetApiURL(formData.getString("targetApiURL")); this.setTargetApiKey(formData.getString("targetApiKey")); this.setTargetHost(formData.getString("targetHost")); this.setTargetPort(formData.getInt("targetPort")); this.setHostname(formData.getString("hostname")); this.setBlacklist(formData.getString("blacklist")); this.setWhitelist(formData.getString("whitelist")); this.setGlobalTagFile(formData.getString("globalTagFile")); this.setGlobalTags(formData.getString("globalTags")); this.setGlobalJobTags(formData.getString("globalJobTags")); this.setEmitSecurityEvents(formData.getBoolean("emitSecurityEvents")); this.setEmitSystemEvents(formData.getBoolean("emitSystemEvents")); save(); ClientFactory.getClient(DatadogClient.ClientType.valueOf(this.getReportWith()), this.getTargetApiURL(), this.getTargetApiKey(), this.getTargetHost(), this.getTargetPort()); } catch(Exception e){ DatadogUtilities.severe(logger, e, "An unexpected error occurred: "); } return super.configure(req, formData); }
Source:
private Set<PageBook.Page> scanPagesToCompile(Set<Class<?>> set) { Set<Templates.Descriptor> templates = Sets.newHashSet(); Set<PageBook.Page> pagesToCompile = Sets.newHashSet(); boolean customTemplatesExist = false; if(!customTemplates.isEmpty()) { customTemplatesExist = true; } for (Class<?> pageClass : set) { EmbedAs embedAs = pageClass.getAnnotation(EmbedAs.class); if (null != embedAs) { final String embedName = embedAs.value(); if (Renderable.class.isAssignableFrom(pageClass)) { @SuppressWarnings("unchecked") Class<? extends Renderable> renderable = (Class<? extends Renderable>) pageClass; registry.add(embedName, renderable); } else { pagesToCompile.add(embed(embedName, pageClass)); } } At at = pageClass.getAnnotation(At.class); if (null != at) { if (pageClass.isAnnotationPresent(Service.class)) { pagesToCompile.add(pageBook.serviceAt(at.value(), pageClass)); } else if (pageClass.isAnnotationPresent(Export.class)) { resourcesService.add(SitebricksModule.class, pageClass.getAnnotation(Export.class)); } else { pagesToCompile.add(pageBook.at(at.value(), pageClass)); } } if (Stage.DEVELOPMENT != currentStage) { if(customTemplatesExist) { if(customTemplates.containsKey(pageClass)) { Templates.Descriptor descriptor = customTemplates.get(pageClass); templates.add(descriptor); continue; } } if (pageClass.isAnnotationPresent(Show.class)) { log.info("replace default template with "+ pageClass.getAnnotation(Show.class).value()); templates.add(new Templates.Descriptor(pageClass, pageClass.getAnnotation(Show.class).value())); } } } if (Stage.DEVELOPMENT != currentStage) { this.templates.loadAll(templates); } return pagesToCompile; }

Target:
private Set<PageBook.Page> scanPagesToCompile(Set<Class<?>> set) { Set<Templates.Descriptor> templates = Sets.newHashSet(); Set<PageBook.Page> pagesToCompile = Sets.newHashSet(); boolean customTemplatesExist = !customTemplates.isEmpty(); for (Class<?> pageClass : set) { EmbedAs embedAs = pageClass.getAnnotation(EmbedAs.class); if (null != embedAs) { final String embedName = embedAs.value(); if (Renderable.class.isAssignableFrom(pageClass)) { @SuppressWarnings("unchecked") Class<? extends Renderable> renderable = (Class<? extends Renderable>) pageClass; registry.add(embedName, renderable); } else { pagesToCompile.add(embed(embedName, pageClass)); } } At at = pageClass.getAnnotation(At.class); if (null != at) { if (pageClass.isAnnotationPresent(Service.class)) { pagesToCompile.add(pageBook.serviceAt(at.value(), pageClass)); } else if (pageClass.isAnnotationPresent(Export.class)) { resourcesService.add(SitebricksModule.class, pageClass.getAnnotation(Export.class)); } else { pagesToCompile.add(pageBook.at(at.value(), pageClass)); } } if (Stage.DEVELOPMENT != currentStage) { if(customTemplatesExist && customTemplates.containsKey(pageClass)) { Templates.Descriptor descriptor = customTemplates.get(pageClass); templates.add(descriptor); continue; } if (pageClass.isAnnotationPresent(Show.class)) { templates.add(new Templates.Descriptor(pageClass, pageClass.getAnnotation(Show.class).value())); } } } if (Stage.DEVELOPMENT != currentStage) { this.templates.loadAll(templates); } return pagesToCompile; }
Source:
protected String getSupportedStorageFormats(Version version) { return Config.getValue(ConfigValues.SupportedStorageFormats, version.toString()); }

Target:
protected String getSupportedStorageFormats(Version version) { return Config.<String> getValue(ConfigValues.SupportedStorageFormats, version.toString()); }
Source:
public FileTailerSink(FileTailerQueue queue, StreamWriter writer, SinkStrategy strategy, FileTailerStateProcessor stateProcessor, FileTailerMetricsProcessor metricsProcessor, int packSize) { if (writer == null) { throw new IllegalArgumentException("Writer can't be empty!"); } this.stateProcessor = stateProcessor; this.metricsProcessor = metricsProcessor; this.queue = queue; this.writer = writer; this.strategy = strategy; this.packSize = packSize; this.random = new Random(); }

Target:
public FileTailerSink(FileTailerQueue queue, StreamWriter writer, SinkStrategy strategy, FileTailerStateProcessor stateProcessor, FileTailerMetricsProcessor metricsProcessor, int packSize) { this.stateProcessor = stateProcessor; this.metricsProcessor = metricsProcessor; this.queue = queue; this.writer = writer; this.strategy = strategy; this.packSize = packSize; this.random = new Random(); }
Source:
public void stop() { hzInstance.getReplicatedMap(CLIENT_UUIDS).remove(hzInstance.getLocalEndpoint().getUuid()); hzInstance.shutdown(); }

Target:
public void stop() { hzInstance.shutdown(); }
Source:
public JPanel drawPreviewOnJPanel() { JPanel pdfImagePanel = new JPanel(); Image generatedImage = PDFPreviewBuilder.buildPDFPreview(selectedPage, viewZoom); if (generatedImage != null) { try { ImageIcon icon = new ImageIcon(generatedImage); JLabel picLabel = new JLabel(icon); pdfImagePanel.add(picLabel); } catch (OutOfMemoryError oome) { } } PDFService.closeDocument(); return pdfImagePanel; }

Target:
public JPanel drawPreviewOnJPanel() { JPanel pdfImagePanel = new JPanel(); Image generatedImage = PDFPreviewBuilder.buildPDFPreview(selectedPage, viewZoom); if (generatedImage != null) { ImageIcon icon = new ImageIcon(generatedImage); JLabel picLabel = new JLabel(icon); pdfImagePanel.add(picLabel); } PDFService.closeDocument(); return pdfImagePanel; }
Source:
private List<List<Long>> readWorkerExecutors(IStormClusterState stormClusterState, String topologyId, String assignmentId, int port) { LOG.info("Reading assignments"); List<List<Long>> executorsAssignedToThisWorker = new ArrayList<>(); executorsAssignedToThisWorker.add(Constants.SYSTEM_EXECUTOR_ID); Map<List<Long>, NodeInfo> executorToNodePort = getLocalAssignment(conf, stormClusterState, topologyId).get_executor_node_port(); for (Map.Entry<List<Long>, NodeInfo> entry : executorToNodePort.entrySet()) { NodeInfo nodeInfo = entry.getValue(); if (nodeInfo.get_node().startsWith(assignmentId) && nodeInfo.get_port().iterator().next() == port) { executorsAssignedToThisWorker.add(entry.getKey()); } } return executorsAssignedToThisWorker; }

Target:
private List<List<Long>> readWorkerExecutors(IStormClusterState stormClusterState, String topologyId, String assignmentId, int port) { LOG.info("Reading assignments"); List<List<Long>> executorsAssignedToThisWorker = new ArrayList<>(); executorsAssignedToThisWorker.add(Constants.SYSTEM_EXECUTOR_ID); Map<List<Long>, NodeInfo> executorToNodePort = getLocalAssignment(stormClusterState, topologyId).get_executor_node_port(); for (Map.Entry<List<Long>, NodeInfo> entry : executorToNodePort.entrySet()) { NodeInfo nodeInfo = entry.getValue(); if (nodeInfo.get_node().equals(assignmentId) && nodeInfo.get_port().iterator().next() == port) { executorsAssignedToThisWorker.add(entry.getKey()); } } return executorsAssignedToThisWorker; }
Source:
public static void main(String[] args) throws Exception { if (args.length < 4) { System.err.println("Usage: WebLogAnalysis <docs> <ranks> <visits> <output>"); return; } String docsInput = args[0]; String ranksInput = args[1]; String visitsInput = args[2]; String output = args[3]; final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSet<Tuple2<String, String>> docs = env.readCsvFile(docsInput) .fieldDelimiter('|') .types(String.class, String.class); DataSet<Tuple3<Integer, String, Integer>> ranks = env.readCsvFile(ranksInput) .fieldDelimiter('|') .types(Integer.class, String.class, Integer.class); DataSet<Tuple2<String, String>> visits = env.readCsvFile(visitsInput) .fieldDelimiter('|') .includeFields("011000000") .types(String.class, String.class); DataSet<Tuple1<String>> filterDocs = docs.filter(new FilterDocs()).project("TF").types(String.class); DataSet<Tuple3<Integer, String, Integer>> filterRanks = ranks.filter(new FilterRanks()); DataSet<Tuple1<String>> filterVisits = visits.filter(new FilterVisits()).project("TF").types(String.class); DataSet<Tuple3<Integer, String, Integer>> joinDocsRanks = filterDocs.join(filterRanks) .where(0).equalTo(1).with(new JoinDocRanks()); DataSet<Tuple3<Integer, String, Integer>> antiJoinVisits = joinDocsRanks.coGroup(filterVisits) .where(1).equalTo(0).with(new AntiJoinVisits()); if (output.equals("STDOUT")) { antiJoinVisits.print(); } else { antiJoinVisits.writeAsCsv(output, "\n", "|"); } env.execute(); }

Target:
public static void main(String[] args) throws Exception { if (args.length < 4) { System.err.println("Usage: WebLogAnalysis <docs> <ranks> <visits> <output>"); return; } String docsInput = args[0]; String ranksInput = args[1]; String visitsInput = args[2]; String output = args[3]; final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); DataSet<Tuple2<String, String>> docs = env.readCsvFile(docsInput) .fieldDelimiter('|') .types(String.class, String.class); DataSet<Tuple3<Integer, String, Integer>> ranks = env.readCsvFile(ranksInput) .fieldDelimiter('|') .types(Integer.class, String.class, Integer.class); DataSet<Tuple2<String, String>> visits = env.readCsvFile(visitsInput) .fieldDelimiter('|') .includeFields("011000000") .types(String.class, String.class); DataSet<Tuple1<String>> filterDocs = docs.filter(new FilterDocs()).project(0).types(String.class); DataSet<Tuple3<Integer, String, Integer>> filterRanks = ranks.filter(new FilterRanks()); DataSet<Tuple1<String>> filterVisits = visits.filter(new FilterVisits()).project(0).types(String.class); DataSet<Tuple3<Integer, String, Integer>> joinDocsRanks = filterDocs.join(filterRanks) .where(0).equalTo(1).projectSecond(0,1,2).types(Integer.class, String.class, Integer.class); DataSet<Tuple3<Integer, String, Integer>> antiJoinVisits = joinDocsRanks.coGroup(filterVisits) .where(1).equalTo(0).with(new AntiJoinVisits()); if (output.equals("STDOUT")) { antiJoinVisits.print(); } else { antiJoinVisits.writeAsCsv(output, "\n", "|"); } env.execute(); }