auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String toString() { if(m_highLoadWatermark != null) { return "Load:" + m_load + ", high water-mark:" + m_highLoadWatermark.intValue(); //$NON-NLS-1$ //$NON-NLS-2$ } else { return "Load:" + m_load + ", high water-mark: not defined"; //$NON-NLS-1$ //$NON-NLS-2$ } }

Target:
public String toString() { if(m_highLoadWatermark != null) { return "Load:" + m_load + ", high water-mark:" + m_highLoadWatermark; //$NON-NLS-1$ //$NON-NLS-2$ } else { return "Load:" + m_load + ", high water-mark: not defined"; //$NON-NLS-1$ //$NON-NLS-2$ } }
Source:
public ISerializableEvaluation unmarshalEvaluation() throws CoreException { int oldPos = fPos; short firstBytes = getShort(); if (firstBytes == NULL_TYPE) { return null; } fPos = oldPos; // fLinkage.unmarshalEvaluation() will read firstBytes again return fLinkage.unmarshalEvaluation(this); }

Target:
public ISerializableEvaluation unmarshalEvaluation() throws CoreException { return fLinkage.unmarshalEvaluation(this); }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { RebaseCurrentRefCommand rebaseCurrent = new RebaseCurrentRefCommand(); rebaseCurrent.setEnabled(event.getApplicationContext()); // Because the enabled state is for both starting a new rebase as well // as working with an existing rebase, it can be that this is executed // even though starting a new rebase is not possible. So check enabled // state again here. See also isEnabled. if (rebaseCurrent.isEnabled()) { return rebaseCurrent.execute(event); } else { return null; } }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { RebaseCurrentRefCommand rebaseCurrent = new RebaseCurrentRefCommand(); rebaseCurrent.setEnabled(event.getApplicationContext()); // Because the enabled state is for both starting a new rebase as well // as working with an existing rebase, it can be that this is executed // even though starting a new rebase is not possible. So check enabled // state again here. See also isEnabled. if (rebaseCurrent.isEnabled()) return rebaseCurrent.execute(event); else return null; }
Source:
private void updateActions() { initialize(); IStructuredSelection selection = getStructuredSelection(); copyDetailsAction.selectionChanged(selection); copyCommenterNameAction.selectionChanged(selection); copyCommentDetailsURL.selectionChanged(selection); Object firstElement = selection.getFirstElement(); if (firstElement != null && firstElement instanceof ITaskComment) { copyCommentDetailsURL.setEnabled(((ITaskComment) firstElement).getUrl() != null); } }

Target:
private void updateActions() { initialize(); IStructuredSelection selection = getStructuredSelection(); copyDetailsAction.selectionChanged(selection); copyCommenterNameAction.selectionChanged(selection); copyCommentDetailsURL.selectionChanged(selection); Object firstElement = selection.getFirstElement(); if (firstElement instanceof ITaskComment) { copyCommentDetailsURL.setEnabled(((ITaskComment) firstElement).getUrl() != null); } }
Source:
public void testCallsiteCopy2() { try { new TmfCallsite(null); fail("null copy"); } catch (final IllegalArgumentException e) { // Success } }

Target:
public void testCallsiteCopy2() { new TmfCallsite(null); }
Source:
private int deltaSizeLimit(DeltaWindowEntry src) { if (bestBase == null) { // Any delta should be no more than 50% of the original size // (for text files deflate of whole form should shrink 50%). int n = res.size() >>> 1; // Evenly distribute delta size limits over allowed depth. // If src is non-delta (depth = 0), delta <= 50% of original. // If src is almost at limit (9/10), delta <= 10% of original. return n - (n * src.depth() / maxDepth); } // With a delta base chosen any new delta must be "better". // Retain the distribution described above. int d = bestBase.depth(); int n = (int) bestDelta.length(); // If src is whole (depth=0) and base is near limit (depth=9/10) // any delta using src can be 10x larger and still be better. // // If src is near limit (depth=9/10) and base is whole (depth=0) // a new delta dependent on src must be 1/10th the size. return n * (maxDepth - src.depth()) / (maxDepth - d); }

Target:
private int deltaSizeLimit(DeltaWindowEntry src) { if (bestBase == null) { // Any delta should be no more than 50% of the original size // (for text files deflate of whole form should shrink 50%). int n = res.size() >>> 1; // Evenly distribute delta size limits over allowed depth. // If src is non-delta (depth = 0), delta <= 50% of original. // If src is almost at limit (9/10), delta <= 10% of original. return n * (maxDepth - src.depth()) / maxDepth; } // With a delta base chosen any new delta must be "better". // Retain the distribution described above. int d = bestBase.depth(); int n = (int) bestDelta.length(); // If src is whole (depth=0) and base is near limit (depth=9/10) // any delta using src can be 10x larger and still be better. // // If src is near limit (depth=9/10) and base is whole (depth=0) // a new delta dependent on src must be 1/10th the size. return n * (maxDepth - src.depth()) / (maxDepth - d); }
Source:
private IdJoinQuery populateBranchIdsJoinIdTable() throws OseeDataStoreException, OseeCoreException { IdJoinQuery branchJoin = JoinUtility.createIdJoinQuery(); // loop through all non-archieved non-deleted non-purged BranchFilter branchFilter = new BranchFilter(BranchArchivedState.UNARCHIVED); branchFilter.setNegatedBranchStates(BranchState.PURGED); branchFilter.setNegatedBranchStates(BranchState.DELETED); for (Branch branch : BranchManager.getBranches(branchFilter)) { branchJoin.add(branch.getId()); } branchJoin.store(); return branchJoin; }

Target:
private IdJoinQuery populateBranchIdsJoinIdTable() throws OseeDataStoreException, OseeCoreException { IdJoinQuery branchJoin = JoinUtility.createIdJoinQuery(); // loop through all non-archieved non-deleted non-purged BranchFilter branchFilter = new BranchFilter(BranchArchivedState.UNARCHIVED); branchFilter.setNegatedBranchStates(BranchState.PURGED, BranchState.DELETED); for (Branch branch : BranchManager.getBranches(branchFilter)) { branchJoin.add(branch.getId()); } branchJoin.store(); return branchJoin; }
Source:
private int getVisibility(int memberIndex) throws CoreException { int visibilityBitOffset = memberIndex % VISIBILITY_VALUES_PER_BYTE; long visibilityOffset = record + MEMBER_VISIBILITIES + memberIndex / VISIBILITY_VALUES_PER_BYTE; int visibility = getDB().getByte(visibilityOffset); // Clearing visibility bits of other members visibility &= VISIBILITY_MASK << visibilityBitOffset * VISIBILITY_BITS; visibility >>>= visibilityBitOffset * VISIBILITY_BITS; return visibility; }

Target:
private int getVisibility(int memberIndex) throws CoreException { int visibilityBitOffset = memberIndex % VISIBILITY_VALUES_PER_BYTE; long visibilityOffset = record + MEMBER_VISIBILITIES + memberIndex / VISIBILITY_VALUES_PER_BYTE; int visibility = getDB().getByte(visibilityOffset); visibility >>>= visibilityBitOffset * VISIBILITY_BITS; // Filtering the visibility bits of the target member visibility &= VISIBILITY_MASK; return visibility; }
Source:
protected String[] getExecutionOrder(String group) { if (GROUP_TOP_LEVEL.equals(group)) { return new String[] { "stepInitializeBaseSequence", //$NON-NLS-1$ "stepSetEnvironmentVariables", //$NON-NLS-1$ "stepSetExecutable", //$NON-NLS-1$ "stepSetArguments", //$NON-NLS-1$ // For remote non-attach only "stepRemoteConnection", //$NON-NLS-1$ // For post-mortem launch only "stepSpecifyCoreFile", //$NON-NLS-1$ "stepStartTrackingBreakpoints", //$NON-NLS-1$ "stepInitializeMemory", //$NON-NLS-1$ "stepStartExecution", //$NON-NLS-1$ "stepCleanupBaseSequence", //$NON-NLS-1$ }; } return null; }

Target:
protected String[] getExecutionOrder(String group) { if (GROUP_TOP_LEVEL.equals(group)) { return new String[] { "stepInitializeBaseSequence", //$NON-NLS-1$ "stepSetEnvironmentVariables", //$NON-NLS-1$ "stepSetExecutable", //$NON-NLS-1$ "stepSetArguments", //$NON-NLS-1$ // For remote non-attach only "stepRemoteConnection", //$NON-NLS-1$ // For post-mortem launch only "stepSpecifyCoreFile", //$NON-NLS-1$ "stepInitializeMemory", //$NON-NLS-1$ "stepStartTrackingBreakpoints", //$NON-NLS-1$ "stepStartExecution", //$NON-NLS-1$ "stepCleanupBaseSequence", //$NON-NLS-1$ }; } return null; }
Source:
public Object getObjectForTextSelection(TextSelection selection, IEditorPart editor) { if (editor instanceof CEditor) { TextSelection textSelection = selection; try { if (selection != null) { return SelectionConverter.getElementAtOffset(getInputCElement((CEditor) editor), textSelection); } else { ICElement element = getInputCElement((CEditor) editor); return element; } } catch (CModelException e) { // ignore } } return null; }

Target:
public Object getObjectForTextSelection(TextSelection selection, IEditorPart editor) { if (editor instanceof CEditor) { TextSelection textSelection = selection; try { ICElement element = getInputCElement((CEditor) editor); if (element != null) { if (selection != null) { return SelectionConverter.getElementAtOffset(element, textSelection); } else { return element; } } } catch (CModelException e) { // ignore } } return null; }
Source:
public static TeamWorkFlowArtifact getCodeTeamWorkflowNamed(String name) throws OseeCoreException { for (Artifact art : ArtifactQuery.getArtifactListFromName(name, AtsUtil.getAtsBranchToken(), DeletionFlag.EXCLUDE_DELETED, QueryOptions.EXACT_MATCH_OPTIONS)) { if (art.isOfType(DemoArtifactTypes.DemoCodeTeamWorkflow)) { return (TeamWorkFlowArtifact) art; } } return null; }

Target:
public static TeamWorkFlowArtifact getCodeTeamWorkflowNamed(String name) throws OseeCoreException { TeamWorkFlowArtifact result = null; for (Artifact art : ArtifactQuery.getArtifactListFromName(name, AtsUtil.getAtsBranchToken(), DeletionFlag.EXCLUDE_DELETED, QueryOptions.EXACT_MATCH_OPTIONS)) { if (art.isOfType(DemoArtifactTypes.DemoCodeTeamWorkflow)) { result = (TeamWorkFlowArtifact) art; break; } } return result; }
Source:
public void setSDWidget(SDWidget sdWidget) { fSdWidget = sdWidget; }

Target:
protected void setSDWidget(SDWidget sdWidget) { fSdWidget = sdWidget; }
Source:
public boolean isNeedInit() { return fNeedInit; }

Target:
private boolean isNeedInit() { return fNeedInit; }
Source:
public boolean isComputeMinMax() { return fComputeMinMax; }

Target:
protected boolean isComputeMinMax() { return fComputeMinMax; }
Source:
public void setStartOccurrence(int occurence) { fStartEventOccurrence = occurence; }

Target:
protected void setStartOccurrence(int occurence) { fStartEventOccurrence = occurence; }
Source:
public Map<String, IFont> getFontPref() { return Collections.unmodifiableMap(fFontPref); }

Target:
protected Map<String, IFont> getFontPref() { return Collections.unmodifiableMap(fFontPref); }
Source:
public Object[] getElements(Object inputElement) { Object[] elements = contentProvider.getElements(inputElement); // add filler elements to ensure alignment with time analysis viewer Object[] oElements = Arrays.copyOf(elements, elements.length + fNumFillerRows); for (int i = 0; i < fNumFillerRows; i++) { oElements[elements.length + i] = FILLER; } return oElements; }

Target:
public Object[] getElements(Object inputElement) { Object[] elements = contentProvider.getElements(inputElement); // add filler elements to ensure alignment with time analysis viewer Object[] oElements = Arrays.copyOf(elements, elements.length + fNumFillerRows, new Object[0].getClass()); for (int i = 0; i < fNumFillerRows; i++) { oElements[elements.length + i] = FILLER; } return oElements; }
Source:
private void execute() throws ExecutionException { IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory(); operationHistory.execute(this, new NullProgressMonitor(), null/*context*/); }

Target:
private void execute() throws ExecutionException { IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory(); operationHistory.execute(this, new NullProgressMonitor(), info); }
Source:
public static ReviewStatus getReviewStatus(com.google.gerrit.reviewdb.Change.Status gerritStatus) { switch (gerritStatus) { case NEW: return ReviewStatus.NEW; case MERGED: return ReviewStatus.MERGED; case SUBMITTED: return ReviewStatus.SUBMITTED; case ABANDONED: return ReviewStatus.ABANDONED; default: if (gerritStatus != null) { GerritCorePlugin.logError("Internal Error: unexpected change status: " + gerritStatus, new Exception()); } // DRAFT is not correctly parsed for ChangeInfo since Change.Status does not define the corresponding enum field return ReviewStatus.DRAFT; } }

Target:
public static ReviewStatus getReviewStatus(com.google.gerrit.reviewdb.Change.Status gerritStatus) { if (gerritStatus == null) { // DRAFT is not correctly parsed for ChangeInfo since Change.Status does not define the corresponding enum field return ReviewStatus.DRAFT; } switch (gerritStatus) { case NEW: return ReviewStatus.NEW; case MERGED: return ReviewStatus.MERGED; case SUBMITTED: return ReviewStatus.SUBMITTED; case ABANDONED: return ReviewStatus.ABANDONED; default: GerritCorePlugin.logError("Internal Error: unexpected change status: " + gerritStatus, new Exception()); return null; } }
Source:
public void setClosed(boolean closed) { if (closed && !isClosed()) { // end list item builder.endBlock(); builder.characters("\n"); //$NON-NLS-1$ // end list block builder.endBlock(); } super.setClosed(closed); }

Target:
public void setClosed(boolean closed) { if (closed && !isClosed()) { // end list item builder.endBlock(); // end list block builder.endBlock(); } super.setClosed(closed); }
Source:
public boolean isSuccessful() { // TODO Auto-generated method stub return false; }

Target:
public boolean isSuccessful() { return true; }
Source:
public PythonEggParser(IFile file) throws IOException, CoreException { setupOptions = new HashMap<String, String>(); variables = new HashMap<String, String>(); // end if file is empty or cannot get its contents if (file.getContents().available() <= 0) return; this.file = file; parse(); }

Target:
public PythonEggParser(IFile file) throws IOException, CoreException { setupOptions = new HashMap<String, String>(); variables = new HashMap<String, String>(); // end if file is empty or cannot get its contents if (file.getContents().available() <= 0) { return; } this.file = file; parse(); }
Source:
public NullOperationLogger() { // singleton so prevent external construction }

Target:
private NullOperationLogger() { // singleton so prevent external construction }
Source:
public void testExecuteQueryRestWithEmptyOption() throws Exception { String query = "status:open"; String option = ""; List<GerritQueryResult> results = null; try { results = executeQueryRest(query, option); } catch (GerritException e) { exception.expect(GerritHttpException.class); exception.expectMessage(HTTP_ERROR_400); return; } assertNotNull(results); }

Target:
public void testExecuteQueryRestWithEmptyOption() throws Exception { String query = "status:open"; String option = ""; List<GerritQueryResult> results = null; results = executeQueryRest(query, option); assertNotNull(results); }
Source:
public static void initializeOprofileModule() { // Check if kernel module is loaded, if not, try to load it if (!isKernelModuleLoaded()) initializeOprofile(); //it still may not have loaded, if not, critical error if (!isKernelModuleLoaded()) { OprofileCorePlugin.showErrorDialog("oprofileInit", null); //$NON-NLS-1$ // throw new ExceptionInInitializerError(OprofileProperties.getString("fatal.kernelModuleNotLoaded")); //$NON-NLS-1$ } else { initializeOprofileCore(); } }

Target:
private static void initializeOprofileModule() { // Check if kernel module is loaded, if not, try to load it if (!isKernelModuleLoaded()) initializeOprofile(); //it still may not have loaded, if not, critical error if (!isKernelModuleLoaded()) { OprofileCorePlugin.showErrorDialog("oprofileInit", null); //$NON-NLS-1$ // throw new ExceptionInInitializerError(OprofileProperties.getString("fatal.kernelModuleNotLoaded")); //$NON-NLS-1$ } else { initializeOprofileCore(); } }
Source:
public static KeyStroke getKeystrokeOfBestActiveBindingFor(String commandId) { KeyStroke stroke = null; IBindingService bindingService = (IBindingService) PlatformUI .getWorkbench().getAdapter(IBindingService.class); TriggerSequence ts = bindingService .getBestActiveBindingFor("org.eclipse.ui.edit.text.contentAssist.proposals"); //$NON-NLS-1$ if (ts == null) return null; Trigger[] triggers = ts.getTriggers(); for (Trigger t : triggers) { if (t instanceof KeyStroke) stroke = (KeyStroke) t; } return stroke; }

Target:
public static KeyStroke getKeystrokeOfBestActiveBindingFor(String commandId) { IBindingService bindingService = (IBindingService) PlatformUI .getWorkbench().getAdapter(IBindingService.class); TriggerSequence ts = bindingService.getBestActiveBindingFor(commandId); if (ts == null) return null; Trigger[] triggers = ts.getTriggers(); if (triggers.length == 1 && triggers[0] instanceof KeyStroke) return (KeyStroke) triggers[0]; else return null; }
Source:
public Change perform(IProgressMonitor pm) throws CoreException { Resource roomRes = rs.getResources().get(0); // resolve all cross references for(Resource res : rs.getResources()) if(res != roomRes) EcoreUtil.resolveAll(res); // change uri of room objects roomRes.setURI(newURI); // perform child changes (and create undo changes): // save only diagrams to change cross references Change undoChange = super.perform(pm); return undoChange; }

Target:
public Change perform(IProgressMonitor pm) throws CoreException { Resource roomRes = rs.getResources().get(0); // resolve all cross references EcoreUtil.resolveAll(rs); // change uri of room objects roomRes.setURI(newURI); // perform child changes (and create undo changes): // save only diagrams to change cross references Change undoChange = super.perform(pm); return undoChange; }
Source:
synchronized PackBitmapIndex getBitmapIndex() throws IOException { if (invalid || invalidBitmap) return null; if (bitmapIdx == null && hasExt(BITMAP_INDEX)) { final PackBitmapIndex idx = PackBitmapIndex.open( extFile(BITMAP_INDEX), idx(), getReverseIdx()); // At this point, idx() will have set packChecksum. if (!Arrays.equals(packChecksum, idx.packChecksum)) invalidBitmap = true; else bitmapIdx = idx; } return bitmapIdx; }

Target:
synchronized PackBitmapIndex getBitmapIndex() throws IOException { if (invalid || invalidBitmap) return null; if (bitmapIdx == null && hasExt(BITMAP_INDEX)) { final PackBitmapIndex idx = PackBitmapIndex.open( extFile(BITMAP_INDEX), idx(), getReverseIdx()); // At this point, idx() will have set packChecksum. if (Arrays.equals(packChecksum, idx.packChecksum)) bitmapIdx = idx; else invalidBitmap = true; } return bitmapIdx; }
Source:
public static URI createURIFor(IFile file) { // whether it exists or not (no longer), use platform:/resource final URI uri; String fullPath = file.getFullPath().toString(); if (isAlreadyEncoded(fullPath)) { uri = URI.createPlatformResourceURI(fullPath, false); } else { uri = URI.createPlatformResourceURI(fullPath, true); } return uri; }

Target:
public static URI createURIFor(IFile file) { // whether it exists or not (no longer), use platform:/resource return URI.createPlatformResourceURI(file.getFullPath().toString(), true); }
Source:
protected Session getSession(URI sessionModelURI) { Session sessionFromURI = null; try { sessionFromURI = SessionManager.INSTANCE.getSession(sessionModelURI); if (sessionFromURI != null) { if (!sessionFromURI.isOpen()) { sessionFromURI.open(new NullProgressMonitor()); } IEditingSession uiSession = SessionUIManager.INSTANCE.getOrCreateUISession(sessionFromURI); uiSession.open(); } } catch (IllegalStateException e) { // Silent catch: can happen if failing to retrieve the session from // its URI } return sessionFromURI; }

Target:
protected Session getSession(URI sessionModelURI) { Session sessionFromURI; try { sessionFromURI = SessionManager.INSTANCE.getSession(sessionModelURI); if (sessionFromURI != null) { if (!sessionFromURI.isOpen()) { sessionFromURI.open(new NullProgressMonitor()); } IEditingSession uiSession = SessionUIManager.INSTANCE.getOrCreateUISession(sessionFromURI); uiSession.open(); } } catch (IllegalStateException e) { sessionFromURI = null; // Silent catch: can happen if failing to retrieve the session from // its URI } return sessionFromURI; }
Source:
public String toString() { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); pw.print("HashSettings:"); for(Map.Entry<String, String> e : settings.entrySet()) pw.print(e.getKey()+"="+e.getValue()+";"); pw.close(); return sw.toString(); }

Target:
public String toString() { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); pw.print("HashSettings:"); //$NON-NLS-1$ for(Map.Entry<String, String> e : settings.entrySet()) { pw.print(e.getKey()+"="+e.getValue()+";"); //$NON-NLS-1$ //$NON-NLS-2$ } pw.close(); return sw.toString(); }
Source:
String getDefault(String val, String defaultVal) { if(val == null || val.trim().equals("")) { //$NON-NLS-1$ return defaultVal; } else { return val; } }

Target:
private String getDefault(String val, String defaultVal) { if (val == null || val.trim().equals("")) { //$NON-NLS-1$ return defaultVal; } else { return val; } }
Source:
public void init(String name, Class<? extends ITmfEvent> type) { super.init(name); fType = type; fDataQueue = (fQueueSize > 1) ? new LinkedBlockingQueue<ITmfEvent>(fQueueSize) : new SynchronousQueue<ITmfEvent>(); if (fExecutor != null) { fExecutor.stop(); } fExecutor = new TmfRequestExecutor(); fSignalDepth = 0; fLogData = TmfCoreTracer.isEventTraced(); // fLogError = TmfCoreTracer.isErrorTraced(); TmfProviderManager.register(fType, this); }

Target:
public void init(String name, Class<? extends ITmfEvent> type) { super.init(name); fType = type; fDataQueue = (fQueueSize > 1) ? new LinkedBlockingQueue<ITmfEvent>(fQueueSize) : new SynchronousQueue<ITmfEvent>(); fExecutor.init(); fSignalDepth = 0; fLogData = TmfCoreTracer.isEventTraced(); // fLogError = TmfCoreTracer.isErrorTraced(); TmfProviderManager.register(fType, this); }
Source:
public synchronized void suspend() { synchronized (fSynchObject) { fIsPaused = true; } TmfCoreTracer.traceRequest(fRequest, "SUSPENDED"); //$NON-NLS-1$ }

Target:
public void suspend() { fIsPaused = true; TmfCoreTracer.traceRequest(fRequest, "SUSPENDED"); //$NON-NLS-1$ }
Source:
public IInputOrder getInputOrder(String path) { // TODO Convert both paths to absolute? for (InputOrder io : getInputOrderList()) { String ioPath = (new Path(io.getPath())).toOSString(); if (path.compareToIgnoreCase(ioPath) == 0) { return io; } } return null; }

Target:
public IInputOrder getInputOrder(String path) { // TODO Convert both paths to absolute? for (InputOrder io : getInputOrderList()) { if (path.compareToIgnoreCase(io.getPath()) == 0) { return io; } } return null; }
Source:
private void createDiff(RevCommit parent) { Diff diff = revision.getDiffToParent(parent); if (diff != null) { try { createDiffLinkAndText(parent, diff); } catch (IOException e) { Activator.logError( "Error creating diff in blame information control for commit " + parent.toObjectId(), e); //$NON-NLS-1$ } } }

Target:
private void createDiff(RevCommit parent) { Diff diff = revision.getDiffToParent(parent); if (diff != null) { try { createDiffLinkAndText(parent, diff); } catch (IOException e) { String msg = "Error creating diff in blame information control for commit " //$NON-NLS-1$ + parent.toObjectId(); Activator.logError(msg, e); } } }
Source:
private Set<String> getStringSet(String key) { String prefSetting = getIndexer().getProperty(key); if (prefSetting != null && prefSetting.length() > 0) { return new HashSet<String>(Arrays.asList(prefSetting.split(","))); //$NON-NLS-1$ } return Collections.emptySet(); }

Target:
private Set<String> getStringSet(String key) { String prefSetting = getIndexer().getProperty(key); if (prefSetting != null && !prefSetting.isEmpty()) { return new HashSet<String>(Arrays.asList(prefSetting.split(","))); //$NON-NLS-1$ } return Collections.emptySet(); }
Source:
protected @NonNull ITmfStateProvider createStateProvider() { ITmfTrace trace = getTrace(); if (!(trace instanceof LttngKernelTrace)) { throw new IllegalStateException("LttngKernelStateSystemModule: trace should be of type LttngKernelTrace"); //$NON-NLS-1$ } return new LttngKernelStateProvider((LttngKernelTrace) trace); }

Target:
protected @NonNull ITmfStateProvider createStateProvider() { return new LttngKernelStateProvider(getTrace()); }
Source:
void writeInfoFromNode(ITmfStateIntervalList stateInfo) { assert (this.isDone); // not sure this will always be the case... if (intervals.size() == 0) { return; } for (int i = 0; i < intervals.size(); i++) { stateInfo.add(intervals.get(i)); } return; }

Target:
void writeInfoFromNode(ITmfStateIntervalList stateInfo) { assert (this.isDone); // not sure this will always be the case... if (intervals.isEmpty()) { return; } for (int i = 0; i < intervals.size(); i++) { stateInfo.add(intervals.get(i)); } return; }
Source:
public void invalidate(final boolean direct) { if (direct) { layoutState = LAYOUT_REDO; // if (getParent() instanceof AbstractBlockBox) { // // The parent box may contain text elements after the edited offset, that has to be updated // ((AbstractBlockBox) getParent()).invalidateChildrenAfterOffset(getStartOffset()); // } } else if (layoutState != LAYOUT_REDO) { layoutState = LAYOUT_PROPAGATE; } if (getParent() instanceof AbstractBlockBox) { ((AbstractBlockBox) getParent()).invalidate(false); } }

Target:
public void invalidate(final boolean direct) { if (direct) { layoutState = LAYOUT_REDO; } else { layoutState = LAYOUT_PROPAGATE; } if (getParent() instanceof AbstractBlockBox) { ((AbstractBlockBox) getParent()).invalidate(false); } }
Source:
public void set(V future) { this.resultObject = future; }

Target:
protected void set(V future) { this.resultObject = future; }
Source:
public void testLoadCacheWrongRepository() throws Exception { BugzillaRestConnector connector = new BugzillaRestConnector(); assertNotNull(connector); assertEquals(connector, BugzillaRestConnector.getDefault()); TaskRepository taskRepository = new TaskRepository(BugzillaRestConnector.getDefault().getConnectorKind(), "http://mylyn.org/bugzilla-rest-trunk-wrong/"); AuthenticationCredentials credentials = new AuthenticationCredentials("username", "password"); taskRepository.setCredentials(AuthenticationType.REPOSITORY, credentials, false); BugzillaRestConfiguration configuration = BugzillaRestConnector.getDefault().getRepositoryConfiguration( taskRepository); assertNull(configuration); }

Target:
public void testLoadCacheWrongRepository() throws Exception { TaskRepository taskRepository = new TaskRepository(connector.getConnectorKind(), "http://mylyn.org/bugzilla-rest-trunk-wrong/"); AuthenticationCredentials credentials = new AuthenticationCredentials("username", "password"); taskRepository.setCredentials(AuthenticationType.REPOSITORY, credentials, false); BugzillaRestConfiguration configuration = connector.getRepositoryConfiguration(taskRepository); assertNull(configuration); }
Source:
protected RGB getBackground() { return fDisplay.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB(); }

Target:
private RGB getBackground() { return fDisplay.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB(); }
Source:
private void initPreferenceDefaults() { getPreferenceStore().setDefault(CHANGE_SET_MANAGE, true); getPreferenceStore().setDefault(COMMIT_TEMPLATE, DEFAULT_COMMIT_TEMPLATE); // 2.0M1 - 2.0M2 Default template migration if (getPreferenceStore().getString(COMMIT_TEMPLATE).equals(OLD_DEFAULT_COMMIT_TEMPLATE) || getPreferenceStore().getString(COMMIT_TEMPLATE).equals(OLD_DEFAULT_COMMIT_TEMPLATE2) || getPreferenceStore().getString(COMMIT_TEMPLATE).equals(OLD_DEFAULT_COMMIT_TEMPLATE3)) { getPreferenceStore().setValue(COMMIT_TEMPLATE, DEFAULT_COMMIT_TEMPLATE); } }

Target:
private void initPreferenceDefaults() { getPreferenceStore().setDefault(CHANGE_SET_MANAGE, true); getPreferenceStore().setDefault(COMMIT_TEMPLATE, DEFAULT_COMMIT_TEMPLATE); }
Source:
public void toggleStarred(String key, String value) { TaskAttribute taskAttribute = fTaskData.getRoot(); taskAttribute.getAttribute(key).setValue(value); // Update the Review Table setAttribute(key, value); }

Target:
public void toggleStarred(String key, String value) { if (key != null && value != null) { TaskAttribute taskAttribute = fTaskData.getRoot(); taskAttribute.getAttribute(key).setValue(value); // Update the Review Table setAttribute(key, value); } }
Source:
public InteractiveUIContent build() { if (isSimple) { // If simple only one element check at a time Preconditions.checkArgument(defaultCheck == null || defaultCheck.size() == 1); } boolean hasConfiguration = configurationUIRegistry != null; if (hasConfiguration) { // If has a configuration composite then the key to retreive te preference shall be set up. Preconditions.checkArgument(configurationNodeKey != null); } final InteractiveUIContent interactiveUI = new InteractiveUIContent(parent, hasDescription, hasConfiguration); CheckboxTableViewer descriptorViewer = createViewer(interactiveUI); if (hasConfiguration) { createConfigurationComposite(interactiveUI); } // Filter input with input with higher rank than default item descriptor setViewerInput(descriptorViewer); // Init and bind data bindAndInit(interactiveUI, descriptorViewer); return interactiveUI; }

Target:
public InteractiveUIContent build() { // If simple only one element check at a time Preconditions.checkArgument(!isSimple || defaultCheck == null || defaultCheck.size() == 1); boolean hasConfiguration = configurationUIRegistry != null; // If has a configuration composite then the key to retrieve the preference must be set up. Preconditions.checkArgument(!hasConfiguration || configurationNodeKey != null); final InteractiveUIContent interactiveUI = new InteractiveUIContent(parent, hasDescription, hasConfiguration); CheckboxTableViewer descriptorViewer = createViewer(interactiveUI); if (hasConfiguration) { createConfigurationComposite(interactiveUI); } setViewerInput(descriptorViewer); // Init and bind data bindAndInit(interactiveUI, descriptorViewer); return interactiveUI; }
Source:
public static String execWithFile(String filename) { try (BufferedReader br = new BufferedReader(new FileReader(filename))) { StringBuffer buffer = new StringBuffer(); String line; while ((line = br.readLine()) != null) { buffer.append(line.concat("\n")); //$NON-NLS-1$ } return exec(buffer.toString()); } catch (IOException e) { e.printStackTrace(); return ""; //$NON-NLS-1$ } }

Target:
public static String execWithFile(String filename) { try (BufferedReader br = new BufferedReader(new FileReader(filename))) { StringBuffer buffer = new StringBuffer(); String line; while ((line = br.readLine()) != null) { buffer.append(line.concat("\n")); //$NON-NLS-1$ } return exec(buffer.toString()); } catch (IOException e) { return ""; //$NON-NLS-1$ } }
Source:
void sendSelection (long /*int*/ id, long /*int*/ sel, long /*int*/ arg) { panel.validateVisibleColumns(); if (filterExtensions.length > 0){ setAllowedFileType(filterExtensions[(int)/*64*/popup.indexOfSelectedItem()]); } }

Target:
void sendSelection (long /*int*/ id, long /*int*/ sel, long /*int*/ arg) { panel.validateVisibleColumns(); if (filterExtensions != null && filterExtensions.length > 0) { setAllowedFileType(filterExtensions[(int)/*64*/popup.indexOfSelectedItem()]); } }
Source:
public void handleData(final @Nullable ITmfEvent event) { super.handleData(event); if (event != null && event.getTrace() != trace) { System.out.println("alld"); //$NON-NLS-1$ } if (event != null && event.getTrace() == trace) { sci.processEvent(event); } }

Target:
public void handleData(final @Nullable ITmfEvent event) { super.handleData(event); if (event != null && event.getTrace() == trace) { sci.processEvent(event); } }
Source:
public EditCommitOperation(Repository repository, RevCommit commit) { if (commit.getParentCount() != 1) { throw new UnsupportedOperationException( "commit is expected to have exactly one parent"); //$NON-NLS-1$ } this.repository = repository; this.commit = commit; }

Target:
public EditCommitOperation(Repository repository, RevCommit commit) { if (commit.getParentCount() != 1) throw new UnsupportedOperationException( "commit is expected to have exactly one parent"); //$NON-NLS-1$ this.repository = repository; this.commit = commit; }
Source:
public void addSubAttribute(Attribute newSubAttribute) { /* This should catch buggy state changing statements */ if (newSubAttribute == null || newSubAttribute.getName() == null || newSubAttribute.getName().equals(this.getName())) { throw new IllegalArgumentException(); } subAttributes.put(newSubAttribute.getName(), newSubAttribute); }

Target:
public void addSubAttribute(Attribute newSubAttribute) { if (newSubAttribute == null || newSubAttribute.getName() == null) { throw new IllegalArgumentException(); } subAttributes.put(newSubAttribute.getName(), newSubAttribute); }
Source:
public int getLength() { Widget widget = getWidget(); int childCount = 0; if (widget instanceof Composite) { childCount = ((Composite) widget).getChildren().length; if (widget instanceof CTabFolder) { // if it's a CTabFolder, include the child items in the count for (CTabItem tabItem : ((CTabFolder) widget).getItems()) { if (tabItem.isDisposed()) { // widget (CTabFolder) is internaly marked as inDispose // It has disposed the CTabItem, but has not taken it out of the items array. // Do not return disposed items to the css engine // TODO: When as to why CTabFolderElement is even getting called is solved, we can remove this guard. System.err.println("CTabItem was disposed"); break; } else { childCount++; } } } } return childCount; }

Target:
public int getLength() { Widget widget = getWidget(); int childCount = 0; if (widget instanceof Composite) { childCount = ((Composite) widget).getChildren().length; if (widget instanceof CTabFolder) { // if it's a CTabFolder, include the child items in the count for (CTabItem tabItem : ((CTabFolder) widget).getItems()) { if (tabItem.isDisposed()) { // THIS IS A WORKAROUND // widget (CTabFolder) is internaly marked as inDispose // It has disposed the CTabItem, but has not taken it out of the items array. // Do not return disposed items to the css engine break; } else { childCount++; } } } } return childCount; }
Source:
Project(String name, String path, String groups) { this.name = name; this.path = path; this.groups = new HashSet<String>(); if (groups != null && groups.length() > 0) { this.groups.addAll(Arrays.asList(groups.split(","))); } }

Target:
Project(String name, String path, String groups) { this.name = name; this.path = path; this.groups = new HashSet<String>(); if (groups != null && groups.length() > 0) this.groups.addAll(Arrays.asList(groups.split(","))); //$NON-NLS-1$ }
Source:
private static PrintStream printTime(long start, long end) { return System.out.format(", %.3f", 0.000000001 * (end - start)); }

Target:
private static void printTime(long start, long end) { /* print out the difference between the two nanosecond times in ms */ System.out.format(", %.3f", 0.000000001 * (end - start)); }
Source:
public void logout(final IProgressMonitor monitor) throws XmlRpcException { userID = -1; token = null; (new BugzillaXmlRpcOperation<Integer>(this) { @SuppressWarnings("serial") @Override public Integer execute() throws XmlRpcException { try { bugzillaClient.authenticate(null); } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } Object response = call(monitor, XML_USER_LOGOUT, null); return -1; } }).execute(); return; }

Target:
public void logout(final IProgressMonitor monitor) throws XmlRpcException { userID = -1; token = null; (new BugzillaXmlRpcOperation<Integer>(this) { @SuppressWarnings("serial") @Override public Integer execute() throws XmlRpcException { try { bugzillaClient.authenticate(monitor); } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } Object response = call(monitor, XML_USER_LOGOUT, null); return -1; } }).execute(); return; }
Source:
public AbstractCommandSelectionDialog(Shell parentShell, IModelResource resource, Messages Messages) { super(parentShell); this.resource = resource; this.Messages = Messages; ToolsEmfUiPlugin.getDefault().registerForLocationAndSizePersistence(this); }

Target:
public AbstractCommandSelectionDialog(Shell parentShell, IModelResource resource, Messages Messages) { super(parentShell); this.resource = resource; this.Messages = Messages; }
Source:
public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> type) throws TmfTraceException { super.initTrace(resource, path, type); fFile = new File(path); try { fFileInput = new RandomAccessFile(fFile, "r"); //$NON-NLS-1$ parseHeader(); } catch (IOException e) { // won't happen } }

Target:
public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> type) throws TmfTraceException { super.initTrace(resource, path, type); fFile = new File(path); try { fFileInput = new RandomAccessFile(fFile, "r"); //$NON-NLS-1$ parseHeader(fFileInput); } catch (IOException e) { // won't happen } }
Source:
public void untrackedFileNotIncluded() throws Exception { String trackedPath = "tracked.txt"; // at least one modification needed writeTrashFile(trackedPath, "content2"); git.add().addFilepattern(trackedPath).call(); RevCommit stashed = git.stashCreate().call(); assertNotNull(stashed); validateStashedCommit(stashed); assertTrue("untracked file should be left untouched.", untrackedFile.exists()); assertEquals("content", read(untrackedFile)); }

Target:
public void untrackedFileNotIncluded() throws Exception { String trackedPath = "tracked.txt"; // at least one modification needed writeTrashFile(trackedPath, "content2"); git.add().addFilepattern(trackedPath).call(); RevCommit stashed = git.stashCreate().call(); validateStashedCommit(stashed); assertTrue("untracked file should be left untouched.", untrackedFile.exists()); assertEquals("content", read(untrackedFile)); }
Source:
protected void handleDemandLoadException(Resource resource, IOException exception) throws RuntimeException { try { super.handleDemandLoadException(resource, exception); } catch (Exception e) { // do nothing, continue with loading, the exception has been added to the diagnostics of the // resource } }

Target:
protected void handleDemandLoadException(Resource resource, IOException exception) throws RuntimeException { try { super.handleDemandLoadException(resource, exception); } catch (RuntimeException e) { // do nothing, continue with loading, the exception has been added to the diagnostics of the // resource } }
Source:
private ICompletionProposal[] computeProposals(int offset) { ICompletionProposal[] proposals = null; boolean succeeded = false; try { if (fContentAssistSubjectControl != null) { proposals = fContentAssistant.computeCompletionProposals(fContentAssistSubjectControl, offset); } else { proposals = fContentAssistant.computeCompletionProposals(fViewer, offset); } succeeded = true; } finally { if (!succeeded) { // Cleanly end the content assist session before propagating an exception (see bug 434901). hide(); } } return proposals; }

Target:
private ICompletionProposal[] computeProposals(int offset) { if (fContentAssistSubjectControl != null) return fContentAssistant.computeCompletionProposals(fContentAssistSubjectControl, offset); return fContentAssistant.computeCompletionProposals(fViewer, offset); }
Source:
public void uncaughtException(Thread t, Throwable e) { if (e instanceof OperationCanceledException) { // handle cancellation } else { if (diagnostic != null) { diagnostic.add(BasicDiagnostic.toDiagnostic(e)); } else { EMFCompareIDEUIPlugin.getDefault().log(e); } } }

Target:
public void uncaughtException(Thread t, Throwable e) { if (e instanceof OperationCanceledException) { // TODO: handle cancellation } else if (diagnostic != null) { diagnostic.add(BasicDiagnostic.toDiagnostic(e)); } else { EMFCompareIDEUIPlugin.getDefault().log(e); } }
Source:
private boolean anyDiffInIndex() throws IOException { Repository repo = getRepository(); TreeWalk treeWalk = new TreeWalk(repo); treeWalk.setRecursive(true); final ObjectId rev = repo.resolve("HEAD"); //$NON-NLS-1$ if (rev!=null) treeWalk.addTree(new RevWalk(repo).parseTree(rev)); treeWalk.addTree(new DirCacheIterator(repo.readDirCache())); treeWalk.setFilter(TreeFilter.ANY_DIFF); return treeWalk.next(); }

Target:
private boolean anyDiffInIndex() throws IOException { final Repository repo = getRepository(); final TreeWalk treeWalk = new TreeWalk(repo); treeWalk.setRecursive(true); //recursive is required because a hash for a (sub)tree might not be available final ObjectId rev = repo.resolve("HEAD"); //$NON-NLS-1$ if (rev != null) { //HEAD doesn't exist for a new repo, then we want to compare against empty tree treeWalk.addTree(new RevWalk(repo).parseTree(rev)); } treeWalk.addTree(new DirCacheIterator(repo.readDirCache())); treeWalk.setFilter(TreeFilter.ANY_DIFF); return treeWalk.next(); }
Source:
public void testLookupVariant() { // we want to test null @SuppressWarnings("null") VariantDefinition result = fixture.lookupVariant(ENUM_8); assertNull(result); }

Target:
public void testLookupVariant() { VariantDefinition result = fixture.lookupVariant(ENUM_8); assertNull(result); }
Source:
@NonNull ByteBuffer getByteBufferAt(long position, long size) throws CTFReaderException, IOException { MappedByteBuffer map = fFileChannel.map(MapMode.READ_ONLY, position, size); if( map == null){ throw new CTFReaderException("Failed to allocate mapped byte buffer"); //$NON-NLS-1$ } return map; }

Target:
ByteBuffer getByteBufferAt(long position, long size) throws CTFReaderException, IOException { MappedByteBuffer map = fFileChannel.map(MapMode.READ_ONLY, position, size); if (map == null) { throw new CTFReaderException("Failed to allocate mapped byte buffer"); //$NON-NLS-1$ } return map; }
Source:
public Color getBackground(Object aElement, int aColumnIndex) { // GerritUi.Ftracer.traceInfo("getBackground column : " + // aColumnIndex + // " ]: "+ aElement ); if (aElement instanceof GerritTask) { GerritTask item = (GerritTask) aElement; // // To modify when we can verify the review state String state = item.getAttribute(GerritTask.IS_STARRED); if (state != null) { if (state.equals("true")) { //$NON-NLS-1$ return INCOMING_COLOR; } else if (state.equals("false")) { //$NON-NLS-1$ return CLOSED_COLOR; } } } return DEFAULT_COLOR; }

Target:
public Color getBackground(Object aElement, int aColumnIndex) { // GerritUi.Ftracer.traceInfo("getBackground column : " + // aColumnIndex + // " ]: "+ aElement ); if (aElement instanceof GerritTask) { GerritTask item = (GerritTask) aElement; // // To modify when we can verify the review state String state = item.getAttribute(GerritTask.IS_STARRED); if (state != null) { if (state.equals(Boolean.toString(true))) { return INCOMING_COLOR; } else if (state.equals(Boolean.toString(false))) { return CLOSED_COLOR; } } } return DEFAULT_COLOR; }
Source:
public int handlesSelection(ISelection selection) { // By default, we don't support anything. int result = 0; Object sel = SelectionUtils.getSelectedObject(selection); if (sel instanceof GdbLaunch || sel instanceof GDBProcess || sel instanceof IDMVMContext) { result = 2; } // While we're here, see if we need to attach debug view listener updateDebugViewListener(); return result; }

Target:
public int handlesSelection(ISelection selection) { // By default, we don't support anything. int result = 0; Object sel = SelectionUtils.getSelectedObject(selection); if (sel instanceof GdbLaunch || sel instanceof GDBProcess || sel instanceof IDMVMContext) { result = 10; } // While we're here, see if we need to attach debug view listener updateDebugViewListener(); return result; }
Source:
public void registerModule(IAnalysisModule module) { if (module == null) { throw new IllegalArgumentException(); } ITmfTrace selectedTrace = TmfTraceManager.getInstance().getActiveTrace(); /* If no trace is active, just register the module */ if (selectedTrace == null) { fModule = module; return; } @SuppressWarnings("resource") IAnalysisModule selectedModule = selectedTrace.getAnalysisModule(module.getId()); /* register only if the module is for the currently selected trace */ if (selectedModule == module) { fModule = module; } }

Target:
public void registerModule(IAnalysisModule module) { if (module == null) { throw new IllegalArgumentException(); } ITmfTrace selectedTrace = TmfTraceManager.getInstance().getActiveTrace(); /* If no trace is active, just register the module */ if (selectedTrace == null) { fModule = module; return; } IAnalysisModule selectedModule = selectedTrace.getAnalysisModule(module.getId()); /* register only if the module is for the currently selected trace */ if (selectedModule == module) { fModule = module; } }
Source:
public static void checkConfiguration() { // Schedule a job // This avoids that the check is executed too early // because in startup phase the JobManager is suspended // and scheduled Jobs are executed later Job job = new Job(UIText.ConfigurationChecker_checkConfiguration) { @Override protected IStatus run(IProgressMonitor monitor) { if (PlatformUI.isWorkbenchRunning()) PlatformUI.getWorkbench().getDisplay() .asyncExec(new Runnable() { public void run() { check(); } }); else schedule(1000L); return Status.OK_STATUS; } }; job.schedule(); }

Target:
public static void checkConfiguration() { // Schedule a job // This avoids that the check is executed too early // because in startup phase the JobManager is suspended // and scheduled Jobs are executed later Job job = new Job(UIText.ConfigurationChecker_checkConfiguration) { @Override protected IStatus run(IProgressMonitor monitor) { if (PlatformUI.isWorkbenchRunning()) { PlatformUI.getWorkbench().getDisplay() .asyncExec(new Runnable() { public void run() { check(); } }); } else { schedule(1000L); } return Status.OK_STATUS; } }; job.schedule(); }
Source:
public void entityReference(String entity) { throw new UnsupportedOperationException("Builder does not currently support entity references."); //$NON-NLS-1$ }

Target:
public void entityReference(String entity) { throw new UnsupportedOperationException(); }
Source:
public Collection<IPatternProvider> getPatternsList() { Collection<IPatternProvider> newPatternList = new ArrayList<IPatternProvider>(); //creating a class Diagram pattern //and create his own command // the command can be changed by configuration page. ClassDiagramPattern pattern = new ClassDiagramPattern(); pattern.setPatternCommand(new InitializerCommand(resourceSet, selection)); newPatternList.add(pattern); return newPatternList; }

Target:
public Collection<IPatternProvider> getPatternsList() { Collection<IPatternProvider> newPatternList = new ArrayList<IPatternProvider>(); // creating a class Diagram pattern ClassDiagramPattern pattern = new ClassDiagramPattern(this.resourceSet, this.selection); newPatternList.add(pattern); return newPatternList; }
Source:
public static TraceLogLevel valueOfString(String name) { if (name == null) { throw new InvalidParameterException(); } for (TraceLogLevel tllevel : TraceLogLevel.values()) { if (tllevel.getInName().equalsIgnoreCase(name)) { return tllevel; } } // No match return LEVEL_UNKNOWN; }

Target:
public static TraceLogLevel valueOfString(String name) { if (name == null) { throw new IllegalArgumentException(); } for (TraceLogLevel tllevel : TraceLogLevel.values()) { if (tllevel.getInName().equalsIgnoreCase(name)) { return tllevel; } } // No match return LEVEL_UNKNOWN; }
Source:
public int compareQualifier(RepositoryVersion other) { if (this.qualifier != null && other.qualifier == null) { return -1; } else { if (this.qualifier == null && other.qualifier != null) { return 1; } else { if (this.qualifier == null && other.qualifier == null) { return 0; } else { return this.qualifier.compareTo(other.qualifier); } } } }

Target:
protected int compareQualifier(RepositoryVersion other) { if (this.qualifier != null && other.qualifier == null) { return -1; } else { if (this.qualifier == null && other.qualifier != null) { return 1; } else { if (this.qualifier == null && other.qualifier == null) { return 0; } else { return this.qualifier.compareTo(other.qualifier); } } } }