auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Response execute(Request request) throws IOException { Map<String, String> headersMap = MutableMap.of(); for (Header header: request.getHeaders()) { headersMap.put(header.getName(), header.getValue()); } String mimeType = "text/plain"; byte[] content = null; TypedOutput body = request.getBody(); if (body != null) { mimeType = request.getBody().mimeType(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { body.writeTo(baos); content = baos.toByteArray(); } catch (IOException e) { <START> throw e; <END> } finally { Streams.closeQuietly(baos); } } final HttpResponse response = httpExecutor.execute(new HttpRequest.Builder() .headers(headersMap) .uri(URI.create(request.getUrl())) .method(request.getMethod()) .body(content) .build()); List<Header> responseHeaders = Lists.newArrayList(); for (Map.Entry<String, String> entry: response.headers().entries()) { responseHeaders.add(new Header(entry.getKey(), entry.getValue())); } TypedInput responseBody = new TypedByteArray(mimeType, ByteStreams.toByteArray(response.getContent())); return new Response(request.getUrl(), response.code(), (response.reasonPhrase() != null) ? response.reasonPhrase() : "", responseHeaders, responseBody); }</code><technical_language>reason remove catch clause</technical_language>

Target:
public Response execute(Request request) throws IOException { Map<String, String> headersMap = MutableMap.of(); for (Header header: request.getHeaders()) { headersMap.put(header.getName(), header.getValue()); } String mimeType = "text/plain"; byte[] content = null; TypedOutput body = request.getBody(); if (body != null) { mimeType = request.getBody().mimeType(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { body.writeTo(baos); content = baos.toByteArray(); } finally { Streams.closeQuietly(baos); } } final HttpResponse response = httpExecutor.execute(new HttpRequest.Builder() .headers(headersMap) .uri(URI.create(request.getUrl())) .method(request.getMethod()) .body(content) .build()); List<Header> responseHeaders = Lists.newArrayList(); for (Map.Entry<String, String> entry: response.headers().entries()) { responseHeaders.add(new Header(entry.getKey(), entry.getValue())); } TypedInput responseBody = new TypedByteArray(mimeType, ByteStreams.toByteArray(response.getContent())); return new Response(request.getUrl(), response.code(), (response.reasonPhrase() != null) ? response.reasonPhrase() : "", responseHeaders, responseBody); }
Source:
<code><START> public AbstractTestQueries(QueryRunnerSupplier supplier) <END> { this(supplier, FeatureSelection.all()); }</code><technical_language>protected, other ctor</technical_language>

Target:
protected AbstractTestQueries(QueryRunnerSupplier supplier) { this(allFeatures(), supplier); }
Source:
<code>public void tearDown() throws IOException { firstProject = null; <START> secondProject = null; <END> }</code><technical_language>This is setting object reference null. saved XML XStream, saved project is remaining</technical_language>

Target:
public void tearDown() throws IOException { }
Source:
<code>public void setName(String name) { Objects.requireNonNull(name); <START> this.name = name; <END> }</code><technical_language>requireNonNull line affectation</technical_language>

Target:
public void setName(String name) { this.name = requireNonNull(name); }
Source:
<code>private static File locateExecutable(String executableName) { if (!PlatformUtil.isWindowsOS()) { return null; } String executableToFindName = Paths.get(PlatformUtil.is64BitOS() ? PLASO64 : PLASO32, executableName).toString(); File exeFile = InstalledFileLocator.getDefault().locate(executableToFindName, PlasoIngestModule.class.getPackage().getName(), false); if (null == exeFile) { return null; } else { return exeFile.canExecute() ? exeFile : null; <START> } <END> }</code><technical_language>Is a simplify a combination of new code code</technical_language>

Target:
private static File locateExecutable(String executableName) { if (!PlatformUtil.isWindowsOS()) { return null; } String executableToFindName = Paths.get(PlatformUtil.is64BitOS() ? PLASO64 : PLASO32, executableName).toString(); File exeFile = InstalledFileLocator.getDefault().locate(executableToFindName, PlasoIngestModule.class.getPackage().getName(), false); if (null != exeFile && exeFile.canExecute()) { return exeFile; } return null; }
Source:
<code>public boolean submit(boolean verify) throws IOException, MessagingException { Set<File> sourceFiles = searchForSourceFiles(fileNames); db(sourceFiles.size() + " source files found"); if (sourceFiles.size() == 0) { String s = "No source files were found."; throw new IllegalStateException(s); } else if (sourceFiles.size() < 3) { <START> String s = "Too few source files were submitted. 3 or more must be submitted."; <END> throw new IllegalStateException(s); } if (verify && !verifySubmission(sourceFiles)) { return false; } this.submitTime = new Date(); File jarFile = makeJarFileWith(sourceFiles); mailTA(jarFile, sourceFiles); mailReceipt(sourceFiles); return true; }</code><technical_language>I a message "Too source files submitted. project requires 3 files submitted. submitted " + sourceFiles.size() + " files". said, thanks for this, @sean97140</technical_language>

Target:
public boolean submit(boolean verify) throws IOException, MessagingException { Set<File> sourceFiles = searchForSourceFiles(fileNames); db(sourceFiles.size() + " source files found"); if (sourceFiles.size() == 0) { String s = "No source files were found."; throw new IllegalStateException(s); } else if (sourceFiles.size() < 3) { String s = "Too few source files were submitted. Each project requires at least 3 files be" + " submitted. You only submitted " + sourceFiles.size() + " files"; throw new IllegalStateException(s); } if (verify && !verifySubmission(sourceFiles)) { return false; } this.submitTime = new Date(); File jarFile = makeJarFileWith(sourceFiles); mailTA(jarFile, sourceFiles); mailReceipt(sourceFiles); return true; }
Source:
<code>public List<RowMap> jsonMaps() { ArrayList<RowMap> list = new ArrayList<>(); Object avalue; Object bvalue; <START> for (Iterator<Pair<Row>> p = filteredRowsBeforeAndAfter().iterator(); p.hasNext(); ) { <END> Pair<Row> rowpair = p.next(); Row after = rowpair.getAfter(); Row before = rowpair.getBefore(); RowMap rowMap = new RowMap( getType(), getDatabase().getName(), getTable().getName(), getHeader().getTimestamp() / 1000, table.getPKList(), this.getNextBinlogPosition()); Iterator<Column> aftIter = after.getColumns().iterator(); Iterator<Column> befIter = before.getColumns().iterator(); Iterator<ColumnDef> defIter = table.getColumnList().iterator(); while ( aftIter.hasNext() && defIter.hasNext() && befIter.hasNext() ) { Column a = aftIter.next(); ColumnDef d = defIter.next(); Column b = befIter.next(); if ( a instanceof DatetimeColumn) { avalue = ((DatetimeColumn) a).getLongValue(); } else { avalue = a.getValue(); } if ( b instanceof DatetimeColumn) { bvalue = ((DatetimeColumn) b).getLongValue(); } else { bvalue = b.getValue(); } if (avalue != null) { avalue = d.asJSON(avalue); if ( !avalue.equals(d.asJSON(bvalue)) ) { bvalue = bvalue != null ? d.asJSON(bvalue) : bvalue; rowMap.putOldData(d.getName(), bvalue); } } else if (bvalue != null) { bvalue = d.asJSON(bvalue); rowMap.putOldData(d.getName(), bvalue); } rowMap.putData(d.getName(), avalue); } list.add(rowMap); } return list; }</code><technical_language>I use: for( Pair<Row> p : filteredRowsBeforeAndAfter() ) { some code iterator needed row, I case anymore</technical_language>

Target:
public List<RowMap> jsonMaps() { ArrayList<RowMap> list = new ArrayList<>(); Object afterValue; Object beforeValue; for (Pair<Row> p : filteredRowsBeforeAndAfter() ) { Row after = p.getAfter(); Row before = p.getBefore(); RowMap rowMap = buildRowMap(); Iterator<Column> aftIter = after.getColumns().iterator(); Iterator<Column> befIter = before.getColumns().iterator(); Iterator<ColumnDef> defIter = table.getColumnList().iterator(); while ( aftIter.hasNext() && defIter.hasNext() && befIter.hasNext() ) { Column afterColumn = aftIter.next(); ColumnDef columnDef = defIter.next(); Column beforeColumn = befIter.next(); afterValue = valueForJson(afterColumn); if ( afterValue != null ) { afterValue = columnDef.asJSON(afterValue); } beforeValue = valueForJson(beforeColumn); if ( beforeValue != null) { beforeValue = columnDef.asJSON(beforeValue); } if ( !Objects.equals(afterValue,beforeValue) ) { rowMap.putOldData(columnDef.getName(), beforeValue); } rowMap.putData(columnDef.getName(), afterValue); } list.add(rowMap); } return list; }
Source:
<code>public void drop() { <START> db.activateOnCurrentThread(); <END> db.drop(); }</code><technical_language>Please change this call private method activateOnCurrentThread() a single entry point</technical_language>

Target:
public void drop() { activateOnCurrentThread(); db.drop(); }
Source:
<code>public void testNegativeTimes() throws IOException, TimeRangeException, StateSystemDisposedException { long startTime = -1001; IStateHistoryBackend backend = getBackendForBuilding(startTime); for (long t = startTime; t <= 200; t += 10) { backend.insertPastState(t, t + 10, 0, t); } backend.finishedBuilding(210); IStateHistoryBackend backendQuery = getBackendForQuerying(backend); <START> backendQuery.doSingularQuery(-1, 0); <END> }</code><technical_language>assert received interval is right one?, a null</technical_language>

Target:
public void testNegativeTimes() throws IOException, TimeRangeException, StateSystemDisposedException { long startTime = -1001; IStateHistoryBackend backend = getBackendForBuilding(startTime); for (long t = startTime; t <= 200; t += 10) { backend.insertPastState(t, t + 10, 0, t); } backend.finishedBuilding(210); IStateHistoryBackend backendQuery = getBackendForQuerying(backend); ITmfStateInterval poisonInterval = backendQuery.doSingularQuery(-1, 0); assertNotNull(poisonInterval); assertEquals(-11L, poisonInterval.getValue()); }
Source:
<code>public static void release(Jedis j, byte[] lockKey, byte[] lockValue) { if (lockValue != null) { j.watch(lockKey); byte[] prevousLockValue = j.get(lockKey); if (Arrays.equals(prevousLockValue, lockValue)) { Transaction transaction = j.multi(); transaction.del(lockKey); boolean succeed = transaction.exec() != null; if (!succeed) { LOG.warn( "Failed to release lock for key {}, meaning the key probably expired because of acquiring the lock for too long (more than {}ms)", new String(lockKey), LOCK_EXP); } } else { LOG.warn( "Nothing to release for key {}, meaning the key probably expired because of acquiring the lock for too long (more than {}ms)", new String(lockKey), LOCK_EXP); j.unwatch(); } if (Arrays.equals(j.get(lockKey), lockValue)) { <START> Long deleted = j.del(lockKey); <END> if (deleted != 1) { } } } else { LOG.warn("Trying to release a lock for with a null value", new String(lockKey)); } }</code><technical_language>Do need this block</technical_language>

Target:
public static void release(Jedis j, byte[] lockKey, byte[] lockValue) { if (lockValue != null) { j.watch(lockKey); byte[] prevousLockValue = j.get(lockKey); if (Arrays.equals(prevousLockValue, lockValue)) { Transaction transaction = j.multi(); transaction.del(lockKey); boolean succeed = transaction.exec() != null; if (!succeed) { LOG.warn( "Failed to release lock for key {}/{}, meaning the key probably expired because of acquiring the lock for too long (more than {}ms)", new String(lockKey), Hex.encodeHexString(lockValue), LOCK_EXP); } } else { LOG.warn( "Nothing to release for key {}/{}, meaning the key probably expired because of acquiring the lock for too long (more than {}ms)", new String(lockKey), Hex.encodeHexString(lockValue), LOCK_EXP); j.unwatch(); } } else { LOG.warn("Trying to release a lock for with a null value", new String(lockKey)); } }
Source:
<code>public final Object toNearRefWithoutResultPromise(final Object[] args) { Actor current = EventualMessage.getActorCurrentMessageIsExecutionOn(); SteppingType step = getStepping(); DirectMessage msg = new DirectMessage(EventualMessage.getCurrentExecutingMessage(), EventualMessage.getCurrentExecutingMessageId(), current, selector, args, current, null, onReceive, messageReceiverBreakpoint.executeCheckIsSetAndEnabled(), promiseResolverBreakpoint.executeCheckIsSetAndEnabled()); <START> msg.setTriggerStepping(step); <END> current.send(msg); return Nil.nilObject; }</code><technical_language>set constructor</technical_language>

Target:
public final Object toNearRefWithoutResultPromise(final Object[] args) { Actor current = EventualMessage.getActorCurrentMessageIsExecutionOn(); DirectMessage msg = new DirectMessage(EventualMessage.getCurrentExecutingMessageId(), current, selector, args, current, null, onReceive, hasMessageReceiverBreakpoint(null), promiseResolverBreakpoint.executeCheckIsSetAndEnabled()); current.send(msg, actorPool); return Nil.nilObject; }
Source:
<code>public boolean doesRemoteFileExist(Path remotePath) throws BackupRestoreException { boolean exists = false; try { exists = s3Client.doesObjectExist(getShard(), remotePath.toString()); <START> } catch (Exception ex) { <END> logger.error( "Exception while checking existence of object: {}. Error: {}", remotePath, ex.getMessage()); } return exists; }</code><technical_language>catch exceptions instead of all</technical_language>

Target:
public boolean doesRemoteFileExist(Path remotePath) throws BackupRestoreException { boolean exists = false; try { exists = s3Client.doesObjectExist(getShard(), remotePath.toString()); } catch (AmazonClientException ex) { logger.error( "Exception while checking existence of object: {}. Error: {}", remotePath, ex.getMessage()); } return exists; }
Source:
<code>synchronized Observable waitForLastAddConfirmedUpdate(long previousLAC, Observer observe) { if ((null != lac && lac > previousLAC) || isClosed || ((stateBits & STATE_FENCED_BIT) == STATE_FENCED_BIT)) { <START> LOG.trace("Wait For LAC , {}", this.lac, previousLAC); <END> return null; } addObserver(observe); return this; }</code><technical_language>if (LOG.isTraceEnabled()) {}</technical_language>

Target:
synchronized Observable waitForLastAddConfirmedUpdate(long previousLAC, Observer observe) { if ((null != lac && lac > previousLAC) || isClosed || ((stateBits & STATE_FENCED_BIT) == STATE_FENCED_BIT)) { if (LOG.isTraceEnabled()) { LOG.trace("Wait For LAC , {}", this.lac, previousLAC); } return null; } addObserver(observe); return this; }
Source:
<code>public byte[] propose(final long seq, @Nullable byte[] bytes) throws PaxosRoundFailureException { final PaxosProposalId proposalId = new PaxosProposalId(proposalNumber.incrementAndGet(), uuid); PaxosValue toPropose = new PaxosValue(uuid, seq, bytes); final PaxosValue finalValue = phaseOne(seq, proposalId, toPropose); phaseTwo(seq, proposalId, finalValue); for (final PaxosLearner learner : learners.keySet()) { if (localLearner == learner) { continue; } <START> ExecutorService executor = learners.get(learner); <END> executor.execute(() -> { try { learner.learn(seq, finalValue); } catch (Throwable e) { log.warn("Failed to teach learner the value at sequence {}", UnsafeArg.of("value", bytes), SafeArg.of("sequence", seq), e); } }); } localLearner.learn(seq, finalValue); return finalValue.getData(); }</code><technical_language>nit: iterate entrySet</technical_language>

Target:
public byte[] propose(final long seq, @Nullable byte[] bytes) throws PaxosRoundFailureException { final PaxosProposalId proposalId = new PaxosProposalId(proposalNumber.incrementAndGet(), uuid); PaxosValue toPropose = new PaxosValue(uuid, seq, bytes); final PaxosValue finalValue = phaseOne(seq, proposalId, toPropose); phaseTwo(seq, proposalId, finalValue); for (final PaxosLearner learner : learners) { if (localLearner == learner) { continue; } executor.execute(() -> { try { learner.learn(seq, finalValue); } catch (Throwable e) { log.warn("Failed to teach learner the value at sequence {}", UnsafeArg.of("value", bytes), SafeArg.of("sequence", seq), e); } }); } localLearner.learn(seq, finalValue); return finalValue.getData(); }
Source:
<code>public String getMessage(String key, String defaultMessage, Locale locale) { ResourceBundle bundle = getBundle(locale); try { String msg = new String(bundle.getString(key).getBytes("ISO-8859-1"), "UTF-8"); return MessageFormat.format(msg, new Object[]{}); } catch (MissingResourceException e) { <START> log.debug("Couldn't load the property " + key); <END> return defaultMessage; } catch (UnsupportedEncodingException e) { throw new IllegalStateException("Couldn't load property from resource bundle", e); } }</code><technical_language>String concatenation in log messages, create GC garbage/overhead if log level is disabled. Please placeholders, e.g.: java log.debug("Couldn't load property for key {}", key);</technical_language>

Target:
public String getMessage(String key, String defaultMessage, Locale locale) { ResourceBundle bundle = getBundle(locale); try { String msg = new String(bundle.getString(key).getBytes("ISO-8859-1"), "UTF-8"); return MessageFormat.format(msg, new Object[]{}); } catch (MissingResourceException e) { log.debug("Couldn't load the property: ", key); return defaultMessage; } catch (UnsupportedEncodingException e) { throw new IllegalStateException("Couldn't load property from resource bundle", e); } }
Source:
<code>public String toString() { return toStringHelper() .add("networkAddress", networkAddress) .add("networkLength", networkLength) .add("portSubnet", portSubnet) .add("portAddress", portAddress) .add("portMac", portMac) .add("routerId", routerId) .add("routeIds", routeIds) <START> .add("serviceContainerIds", <END> serviceContainerId) .toString(); }</code><technical_language>"s"</technical_language>

Target:
public String toString() { return toStringHelper() .add("networkAddress", networkAddress) .add("networkLength", networkLength) .add("portSubnet", portSubnet) .add("portAddress", portAddress) .add("portMac", portMac) .add("routerId", routerId) .add("routeIds", routeIds) .toString(); }
Source:
<code>public OptionalInt tryConvertToDirect(int maxDirectBytes) { checkState(!closed); checkState(!directEncoded); if (directColumnWriter == null) { directColumnWriter = new SliceDirectColumnWriter(column, type, compression, bufferSize, orcEncoding, this::newStringStatisticsBuilder); } checkState(directColumnWriter.getBufferedBytes() == 0); Block dictionaryValues = dictionary.getElementBlock(); for (DictionaryRowGroup rowGroup : rowGroups) { directColumnWriter.beginRowGroup(); <START> if (!writeDictionaryRowGroup(dictionaryValues, rowGroup.getValueCount(), rowGroup.getDictionaryIndexes(), maxDirectBytes)) { <END> return OptionalInt.empty(); } directColumnWriter.finishRowGroup(); } if (inRowGroup) { directColumnWriter.beginRowGroup(); if (!writeDictionaryRowGroup(dictionaryValues, rowGroupValueCount, values, maxDirectBytes)) { return OptionalInt.empty(); } } else { checkState(rowGroupValueCount == 0); } rowGroups.clear(); dictionary.clear(); rawBytes = 0; totalValueCount = 0; totalNonNullValueCount = 0; rowGroupValueCount = 0; statisticsBuilder = newStringStatisticsBuilder(); directEncoded = true; return OptionalInt.of(toIntExact(directColumnWriter.getBufferedBytes())); }</code><technical_language>Do existing test covers this</technical_language>

Target:
public OptionalInt tryConvertToDirect(int maxDirectBytes) { checkState(!closed); checkState(!directEncoded); if (directColumnWriter == null) { directColumnWriter = new SliceDirectColumnWriter(column, type, compression, bufferSize, orcEncoding, this::newStringStatisticsBuilder); } checkState(directColumnWriter.getBufferedBytes() == 0); Block dictionaryValues = dictionary.getElementBlock(); for (DictionaryRowGroup rowGroup : rowGroups) { directColumnWriter.beginRowGroup(); boolean success = writeDictionaryRowGroup(dictionaryValues, rowGroup.getValueCount(), rowGroup.getDictionaryIndexes(), maxDirectBytes); directColumnWriter.finishRowGroup(); if (!success) { directColumnWriter.close(); directColumnWriter.reset(); return OptionalInt.empty(); } } if (inRowGroup) { directColumnWriter.beginRowGroup(); if (!writeDictionaryRowGroup(dictionaryValues, rowGroupValueCount, values, maxDirectBytes)) { directColumnWriter.close(); directColumnWriter.reset(); return OptionalInt.empty(); } } else { checkState(rowGroupValueCount == 0); } rowGroups.clear(); dictionary.clear(); rawBytes = 0; totalValueCount = 0; totalNonNullValueCount = 0; rowGroupValueCount = 0; statisticsBuilder = newStringStatisticsBuilder(); directEncoded = true; return OptionalInt.of(toIntExact(directColumnWriter.getBufferedBytes())); }
Source:
<code>private void sendUnauthorized(HttpServletResponse response, boolean close) { try { if (close) { response.setHeader(IWAConstants.AUTHENTICATE_HEADER, IWAConstants.NEGOTIATE_HEADER); response.addHeader(IWAConstants.HTTP_CONNECTION_HEADER, IWAConstants.CONNECTION_CLOSE); } else { response.setHeader(IWAConstants.AUTHENTICATE_HEADER, IWAConstants.NEGOTIATE_HEADER); response.addHeader(IWAConstants.HTTP_CONNECTION_HEADER, IWAConstants.CONNECTION_KEEP_ALIVE); } response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); response.flushBuffer(); } catch (IOException e) { <START> log.error("Error when sending unauthorized response." + e); <END> } }</code><technical_language>Change this log.error("Error sending unauthorized response.", e); this is added</technical_language>

Target:
private void sendUnauthorized(HttpServletResponse response, boolean close) { try { if (close) { response.setHeader(IWAConstants.AUTHENTICATE_HEADER, IWAConstants.NEGOTIATE_HEADER); response.addHeader(IWAConstants.HTTP_CONNECTION_HEADER, IWAConstants.CONNECTION_CLOSE); } else { response.setHeader(IWAConstants.AUTHENTICATE_HEADER, IWAConstants.NEGOTIATE_HEADER); response.addHeader(IWAConstants.HTTP_CONNECTION_HEADER, IWAConstants.CONNECTION_KEEP_ALIVE); } response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); response.flushBuffer(); } catch (IOException e) { log.error("Error when sending unauthorized response.", e); } }
Source:
<code>private static byte[] serializeBookieServiceInfo(BookieServiceInfo bookieServiceInfo) { <START> log.info("serialize BookieServiceInfo {}", bookieServiceInfo); <END> try (ByteArrayOutputStream os = new ByteArrayOutputStream()) { BookieServiceInfoFormat.Builder builder = BookieServiceInfoFormat.newBuilder(); List<BookieServiceInfoFormat.Endpoint> bsiEndpoints = bookieServiceInfo.getEndpoints().stream() .map(e -> { return BookieServiceInfoFormat.Endpoint.newBuilder() .setId(e.getId()) .setPort(e.getPort()) .setHost(e.getHost()) .setProtocol(e.getProtocol()) .addAllAuth(e.getAuth()) .addAllExtensions(e.getExtensions()) .build(); }) .collect(Collectors.toList()); builder.addAllEndpoints(bsiEndpoints); builder.putAllProperties(bookieServiceInfo.getProperties()); builder.build().writeTo(os); return os.toByteArray(); } catch (IOException err) { log.error("Cannot serialize bookieServiceInfo from " + bookieServiceInfo); throw new RuntimeException(err); } }</code><technical_language>debug level</technical_language>

Target:
static byte[] serializeBookieServiceInfo(BookieServiceInfo bookieServiceInfo) { if (log.isDebugEnabled()) { log.debug("serialize BookieServiceInfo {}", bookieServiceInfo); } try (ByteArrayOutputStream os = new ByteArrayOutputStream()) { BookieServiceInfoFormat.Builder builder = BookieServiceInfoFormat.newBuilder(); List<BookieServiceInfoFormat.Endpoint> bsiEndpoints = bookieServiceInfo.getEndpoints().stream() .map(e -> { return BookieServiceInfoFormat.Endpoint.newBuilder() .setId(e.getId()) .setPort(e.getPort()) .setHost(e.getHost()) .setProtocol(e.getProtocol()) .addAllAuth(e.getAuth()) .addAllExtensions(e.getExtensions()) .build(); }) .collect(Collectors.toList()); builder.addAllEndpoints(bsiEndpoints); builder.putAllProperties(bookieServiceInfo.getProperties()); builder.build().writeTo(os); return os.toByteArray(); } catch (IOException err) { log.error("Cannot serialize bookieServiceInfo from " + bookieServiceInfo); throw new RuntimeException(err); } }
Source:
<code>private void setInstructorsIsArchivedInCourse(CourseAttributes course) throws InvalidParametersException, EntityDoesNotExistException { System.out.println("Updating instructors of old archived course: " + course.id); List<InstructorAttributes> instructorList = logic.getInstructorsForCourse(course.id); for (InstructorAttributes instructor: instructorList) { <START> if (isPreview) { <END> System.out.println("Instructor: " + instructor.googleId + " : " + instructor.isArchived); if (instructor.isArchived == null) { System.out.println("======= Migration has not been done yet ======="); } } else { if (instructor.isArchived == null) { instructor.isArchived = true; logic.updateInstructorByEmail(instructor.email, instructor); System.out.println("Successfully updated instructor: [" + instructor.email + "] " + instructor.name); } } } System.out.println(""); }</code><technical_language>code move this branch another function level of abstraction? is for previewing in setInstructorsIsArchivedInCourse() function</technical_language>

Target:
private void setInstructorsIsArchivedInCourse(CourseAttributes course) throws InvalidParametersException, EntityDoesNotExistException { Assumption.assertEquals(false, isPreview); Assumption.assertTrue(course.isArchived); System.out.println("Updating instructors of old archived course: " + course.id); List<InstructorAttributes> instructorsOfCourse = logic.getInstructorsForCourse(course.id); for (InstructorAttributes instructor: instructorsOfCourse) { if (instructor.isArchived == null) { instructor.isArchived = true; logic.updateInstructorByEmail(instructor.email, instructor); System.out.println("Successfully updated instructor: [" + instructor.email + "] " + instructor.name); } } System.out.println(""); }
Source:
<code>public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event, long hoverTime) { Map<String, String> retMap = super.getEventHoverToolTipInfo(event, hoverTime); if (retMap == null) { retMap = new LinkedHashMap<>(1); } if (!(event instanceof TimeEvent) || !((TimeEvent) event).hasValue() || !(event.getEntry() instanceof TimeGraphEntry)) { return retMap; } TimeGraphEntry entry = (TimeGraphEntry) event.getEntry(); ITimeGraphDataProvider<? extends TimeGraphEntryModel> dataProvider = BaseDataProviderTimeGraphView.getProvider(entry); <START> Map<String, Object> parameters = FetchParametersUtils.selectionTimeQueryToMap(new SelectionTimeQueryFilter(hoverTime, hoverTime, 1, Collections.singletonList(entry.getEntryModel().getId()))); <END> TmfModelResponse<@NonNull Map<@NonNull String, @NonNull String>> response = dataProvider.fetchTooltip(parameters, null); Map<@NonNull String, @NonNull String> map = response.getModel(); if (map != null) { retMap.putAll(map); } return retMap; }</code><technical_language>Map<@NonNull String, @NonNull Object></technical_language>

Target:
public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event, long hoverTime) { Map<String, String> retMap = super.getEventHoverToolTipInfo(event, hoverTime); if (retMap == null) { retMap = new LinkedHashMap<>(1); } if (!(event instanceof TimeEvent) || !((TimeEvent) event).hasValue() || !(event.getEntry() instanceof TimeGraphEntry)) { return retMap; } TimeGraphEntry entry = (TimeGraphEntry) event.getEntry(); ITimeGraphDataProvider<? extends TimeGraphEntryModel> dataProvider = BaseDataProviderTimeGraphView.getProvider(entry); Map<@NonNull String, @NonNull Object> parameters = FetchParametersUtils.selectionTimeQueryToMap(new SelectionTimeQueryFilter(hoverTime, hoverTime, 1, Collections.singletonList(entry.getEntryModel().getId()))); TmfModelResponse<@NonNull Map<@NonNull String, @NonNull String>> response = dataProvider.fetchTooltip(parameters, null); Map<@NonNull String, @NonNull String> map = response.getModel(); if (map != null) { retMap.putAll(map); } return retMap; }
Source:
<code>private static String applyMappings(String text, Map<String, String> mappings, List<String> keys) { <START> TreeSet<Range> ranges = new TreeSet<Range>(new Comparator<Range>() { <END> @Override public int compare(Range r1, Range r2) { int maxStart = Math.max(r1.start, r2.start); int minEnd = Math.min(r1.end, r2.end); if (maxStart < minEnd) { return 0; } else { return Integer.compare(r2.end, r1.end); } } }); for (String key : keys) { Pattern keyPattern = Pattern.compile(Pattern.quote(key)); Matcher matcher = keyPattern.matcher(text); String replacement = mappings.get(key); while (matcher.find()) { int startId = matcher.start(); int endId = matcher.end(); Range range = new Range(startId, endId, replacement); ranges.add(range); } } for (Range range : ranges) { String left = text.substring(0, range.start); String middle = range.text; String end = text.substring(range.end); text = left + middle + end; } return text; }</code><technical_language>Minor nit: this static final class instantiate one</technical_language>

Target:
private static String applyMappings(String text, Map<String, String> mappings, List<String> keys) { TreeSet<Range> ranges = new TreeSet<Range>(rangeComparator); for (String key : keys) { Pattern keyPattern = Pattern.compile(Pattern.quote(key)); Matcher matcher = keyPattern.matcher(text); String replacement = mappings.get(key); while (matcher.find()) { int startId = matcher.start(); int endId = matcher.end(); Range range = new Range(startId, endId, replacement); ranges.add(range); } } for (Range range : ranges) { String left = text.substring(0, range.start); String middle = range.text; String end = text.substring(range.end); text = left + middle + end; } return text; }
Source:
<code>private void executeRequest(Weather weather, String url, LocationConfig locationConfig) throws Exception { try { logger.trace("{}[{}]: request : {}", getProviderName(), locationConfig.getLocationId(), url); String response = StringUtils.trimToEmpty(HttpUtil.executeUrl( "GET", url, 15000)); if ((weather.getProvider() == ProviderName.WEATHERBIT) && StringUtils.contains(url, "forecast/daily")) { response = StringUtils.replace(response, "data", "forecast"); } if (logger.isTraceEnabled()) { response = StringUtils.remove(response, "\n"); response = StringUtils.trim(response); logger.trace("{}[{}]: response: {}", getProviderName(), locationConfig.getLocationId(), response); } if (!response.isEmpty()) { parser.parseInto(response, weather); } <START> if ((weather.getProvider() == ProviderName.OPENWEATHERMAP) && <END> (weather.getResponseCode() != null) && (weather.getResponseCode() == 200)) { weather.setError(null); } if (!weather.hasError() && response.isEmpty()) { weather.setError("Error: response is empty!"); } if (weather.hasError()) { logger.error("{}[{}]: Can't retreive weather data: {}", getProviderName(), locationConfig.getLocationId(), weather.getError()); } else { setLastUpdate(weather); } } catch (Exception ex) { logger.error(getProviderName() + ": " + ex.getMessage()); weather.setError(ex.getClass().getSimpleName() + ": " + ex.getMessage()); throw ex; } }</code><technical_language>Remove extraneous parentheses</technical_language>

Target:
private void executeRequest(Weather weather, String url, LocationConfig locationConfig) throws Exception { try { logger.trace("{}[{}]: request : {}", getProviderName(), locationConfig.getLocationId(), url); String response = StringUtils.trimToEmpty(HttpUtil.executeUrl( "GET", url, 15000)); if ((weather.getProvider() == ProviderName.WEATHERBIT) && StringUtils.contains(url, "forecast/daily")) { response = StringUtils.replace(response, "data", "forecast"); } if (logger.isTraceEnabled()) { response = StringUtils.remove(response, "\n"); response = StringUtils.trim(response); logger.trace("{}[{}]: response: {}", getProviderName(), locationConfig.getLocationId(), response); } if (!response.isEmpty()) { parser.parseInto(response, weather); } if (weather.getProvider() == ProviderName.OPENWEATHERMAP && weather.getResponseCode() != null && weather.getResponseCode() == 200) { weather.setError(null); } if (!weather.hasError() && response.isEmpty()) { weather.setError("Error: response is empty!"); } if (weather.hasError()) { logger.error("{}[{}]: Can't retrieve weather data: {}", getProviderName(), locationConfig.getLocationId(), weather.getError()); } else { setLastUpdate(weather); } } catch (Exception ex) { logger.error(getProviderName() + ": " + ex.getMessage()); weather.setError(ex.getClass().getSimpleName() + ": " + ex.getMessage()); throw ex; } }
Source:
<code>public static Object convert(Object source, Attribute attr) { try { switch (attr.getDataType()) { case BOOL: return toBoolean(source); case XREF: case CATEGORICAL: case CATEGORICAL_MREF: case MREF: case FILE: case ONE_TO_MANY: return source; case COMPOUND: throw new UnsupportedOperationException(); case DATE: return toLocalDate(source); case DATE_TIME: return toInstant(source); case DECIMAL: return toDouble(source); case INT: return toInt(source); case LONG: return toLong(source); default: return toString(source); } } catch (ConversionFailedException cfe) { <START> throw new AttributeValueConversionFailedException(attr, source); <END> } }</code><technical_language>Eats cause</technical_language>

Target:
public static Object convert(Object source, Attribute attr) { try { switch (attr.getDataType()) { case BOOL: return toBoolean(source); case XREF: case CATEGORICAL: case CATEGORICAL_MREF: case MREF: case FILE: case ONE_TO_MANY: return source; case COMPOUND: throw new UnsupportedOperationException(); case DATE: return toLocalDate(source); case DATE_TIME: return toInstant(source); case DECIMAL: return toDouble(source); case INT: return toInt(source); case LONG: return toLong(source); default: return toString(source); } } catch (ConversionFailedException cfe) { throw new AttributeValueConversionException(attr, source, cfe); } }
Source:
<code>public void debugClearLocalData() throws MessagingException { if (!K9.DEVELOPER_MODE) { <START> throw new AssertionError("method must only be used in debug build!"); <END> } try { localStore.getDatabase().execute(true, new DbCallback<Void>() { @Override public Void doDbWork(final SQLiteDatabase db) throws WrappedException, MessagingException { ContentValues cv = new ContentValues(); cv.putNull("message_part_id"); db.update("messages", cv, "id = ?", new String[] { Long.toString(databaseId) }); try { ((LocalFolder) mFolder).deleteMessagePartsAndDataFromDisk(messagePartId); } catch (MessagingException e) { throw new WrappedException(e); } setFlag(Flag.X_DOWNLOADED_FULL, false); setFlag(Flag.X_DOWNLOADED_PARTIAL, false); return null; } }); } catch (WrappedException e) { throw (MessagingException) e.getCause(); } localStore.notifyChange(); }</code><technical_language>Please update this string "developer mode" instead of "debug build"</technical_language>

Target:
public void debugClearLocalData() throws MessagingException { if (!K9.DEVELOPER_MODE) { throw new AssertionError("method must only be used in developer mode!"); } try { localStore.getDatabase().execute(true, new DbCallback<Void>() { @Override public Void doDbWork(final SQLiteDatabase db) throws WrappedException, MessagingException { ContentValues cv = new ContentValues(); cv.putNull("message_part_id"); db.update("messages", cv, "id = ?", new String[] { Long.toString(databaseId) }); try { ((LocalFolder) mFolder).deleteMessagePartsAndDataFromDisk(messagePartId); } catch (MessagingException e) { throw new WrappedException(e); } setFlag(Flag.X_DOWNLOADED_FULL, false); setFlag(Flag.X_DOWNLOADED_PARTIAL, false); return null; } }); } catch (WrappedException e) { throw (MessagingException) e.getCause(); } localStore.notifyChange(); }
Source:
<code>public <T extends Component> T getModuleConfig(SimpleUri uri, String key, Class<T> clazz) { Map<String, JsonElement> map = moduleConfigs.get(uri); if (map == null) { return null; } JsonElement element = map.get(key); <START> Gson gson = new Gson(); <END> return gson.fromJson(element, clazz); }</code><technical_language>need consider hooking TypeHandlers in future - moving JsonElement class conversion elsewhere. important right now, types assets supported</technical_language>

Target:
public <T extends Component> T getModuleConfig(SimpleUri uri, String key, Class<T> clazz) { Map<String, JsonElement> map = moduleConfigs.get(uri); if (map == null) { return null; } JsonElement element = map.get(key); Gson gson = createGsonForModules(); return gson.fromJson(element, clazz); }
Source:
<code>public static void export(Path exportDir, BriefcaseFormDefinition formDefinition, String baseFilename, boolean exportMedia, boolean overwriteFiles, Optional<LocalDate> startDate, Optional<LocalDate> endDate) { log.info("exporting to : " + exportDir); ExportToCsv action = new ExportToCsv( new TerminationFuture(), exportDir.toFile(), formDefinition, baseFilename, exportMedia, <START> overwriteFiles, startDate.map((LocalDate ld) -> Date.from(ld.atStartOfDay(ZoneId.systemDefault()).toInstant())).orElse(null), <END> endDate.map((LocalDate ld) -> Date.from(ld.atStartOfDay(ZoneId.systemDefault()).toInstant())).orElse(null) ); try { boolean allSuccessful = action.doAction(); if (allSuccessful && action.someSkipped()) EventBus.publish(new ExportSucceededWithErrorsEvent(action.getFormDefinition())); if (allSuccessful && action.noneSkipped()) EventBus.publish(new ExportSucceededEvent(action.getFormDefinition())); if (allSuccessful && action.allSkipped()) throw new ExportException(formDefinition, "None of the instances where exported"); if (!allSuccessful) throw new ExportException(formDefinition); } catch (Throwable t) { throw new ExportException(formDefinition); } }</code><technical_language>reason type inference here? ... startDate.map(ld -> ..., endDate.map(ld -> ..</technical_language>

Target:
public static void export(Path exportDir, BriefcaseFormDefinition formDefinition, String baseFilename, boolean exportMedia, boolean overwriteFiles, Optional<LocalDate> startDate, Optional<LocalDate> endDate) { log.info("exporting to : " + exportDir); ExportToCsv action = new ExportToCsv( new TerminationFuture(), exportDir.toFile(), formDefinition, baseFilename, exportMedia, overwriteFiles, startDate.map(ld -> Date.from(ld.atStartOfDay(systemDefault()).toInstant())).orElse(null), endDate.map(ld -> Date.from(ld.atStartOfDay(systemDefault()).toInstant())).orElse(null) ); try { boolean allSuccessful = action.doAction(); if (allSuccessful && action.someSkipped()) EventBus.publish(new ExportSucceededWithErrorsEvent(action.getFormDefinition())); if (allSuccessful && action.noneSkipped()) EventBus.publish(new ExportSucceededEvent(action.getFormDefinition())); if (allSuccessful && action.allSkipped()) throw new ExportException(formDefinition, "None of the instances where exported"); if (!allSuccessful) throw new ExportException(formDefinition); } catch (Throwable t) { throw new ExportException(formDefinition); } }
Source:
<code>private static void readSliceHeader(final int major, final Slice slice, final InputStream readInputStream) throws IOException { slice.headerBlock = Block.read(major, readInputStream); if (slice.headerBlock.getContentType() != BlockContentType.MAPPED_SLICE) <START> throw new RuntimeException("Content type does not match: " + slice.headerBlock.getContentType().name()); <END> final InputStream parseInputStream = new ByteArrayInputStream(slice.headerBlock.getUncompressedContent()); slice.sequenceId = ITF8.readUnsignedITF8(parseInputStream); slice.alignmentStart = ITF8.readUnsignedITF8(parseInputStream); slice.alignmentSpan = ITF8.readUnsignedITF8(parseInputStream); slice.nofRecords = ITF8.readUnsignedITF8(parseInputStream); slice.globalRecordCounter = LTF8.readUnsignedLTF8(parseInputStream); slice.nofBlocks = ITF8.readUnsignedITF8(parseInputStream); slice.contentIDs = CramIntArray.array(parseInputStream); slice.embeddedRefBlockContentID = ITF8.readUnsignedITF8(parseInputStream); slice.refMD5 = new byte[16]; InputStreamUtils.readFully(parseInputStream, slice.refMD5, 0, slice.refMD5.length); final byte[] bytes = InputStreamUtils.readFully(parseInputStream); if (major >= CramVersions.CRAM_v3.major) { slice.sliceTags = BinaryTagCodec.readTags(bytes, 0, bytes.length, ValidationStringency.DEFAULT_STRINGENCY); SAMBinaryTagAndValue tags = slice.sliceTags; while (tags != null) { log.debug(String.format("Found slice tag: %s", SAMTag.makeStringTag(tags.tag))); tags = tags.getNext(); } } }</code><technical_language>is expected, i.e., "expected a slice header, a ...." that</technical_language>

Target:
private static void readSliceHeader(final int major, final Slice slice, final InputStream readInputStream) throws IOException { slice.headerBlock = Block.read(major, readInputStream); if (slice.headerBlock.getContentType() != BlockContentType.MAPPED_SLICE) throw new RuntimeException("Slice Header Block expected, found: " + slice.headerBlock.getContentType().name()); final InputStream parseInputStream = new ByteArrayInputStream(slice.headerBlock.getUncompressedContent()); slice.sequenceId = ITF8.readUnsignedITF8(parseInputStream); slice.alignmentStart = ITF8.readUnsignedITF8(parseInputStream); slice.alignmentSpan = ITF8.readUnsignedITF8(parseInputStream); slice.nofRecords = ITF8.readUnsignedITF8(parseInputStream); slice.globalRecordCounter = LTF8.readUnsignedLTF8(parseInputStream); slice.nofBlocks = ITF8.readUnsignedITF8(parseInputStream); slice.contentIDs = CramIntArray.array(parseInputStream); slice.embeddedRefBlockContentID = ITF8.readUnsignedITF8(parseInputStream); slice.refMD5 = new byte[16]; InputStreamUtils.readFully(parseInputStream, slice.refMD5, 0, slice.refMD5.length); final byte[] bytes = InputStreamUtils.readFully(parseInputStream); if (major >= CramVersions.CRAM_v3.major) { slice.sliceTags = BinaryTagCodec.readTags(bytes, 0, bytes.length, ValidationStringency.DEFAULT_STRINGENCY); SAMBinaryTagAndValue tags = slice.sliceTags; while (tags != null) { log.debug(String.format("Found slice tag: %s", SAMTag.makeStringTag(tags.tag))); tags = tags.getNext(); } } }
Source:
<code>void unpackId(String id) { if (id != null && id.length() > 0) { this.id = id; try { URL url = new URL(id); String[] tokens = url.getPath().split("/"); this.vaultUrl = (tokens.length >= 1 ? tokens[1] : null); this.name = (tokens.length >= 3 ? tokens[2] : null); } catch (MalformedURLException e) { <START> e.printStackTrace(); <END> } } }</code><technical_language>this logged properly. in Certificate Properties too</technical_language>

Target:
void unpackId(String id) { if (id != null && id.length() > 0) { this.id = id; try { URL url = new URL(id); String[] tokens = url.getPath().split("/"); this.vaultUrl = (tokens.length >= 2 ? tokens[1] : null); this.name = (tokens.length >= 3 ? tokens[2] : null); } catch (MalformedURLException e) { throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Key Vault endpoint url is malformed.", e)); } } }
Source:
<code><START> public void validateSurveillanceAuthority(Surveillance surv) { <END> Boolean hasOncStaff = Util.isUserRoleOncStaff(); Boolean hasAcbAdmin = Util.isUserRoleAcbAdmin(); if(surv.getAuthority() == null){ if(hasAcbAdmin && hasOncStaff){ surv.getErrorMessages().add("User cannot have authority for " + Authority.ROLE_ONC_STAFF + " and " + Authority.ROLE_ACB_ADMIN + "."); } } else { if(!surv.getAuthority().equalsIgnoreCase(Authority.ROLE_ACB_ADMIN) && !surv.getAuthority().equalsIgnoreCase(Authority.ROLE_ONC_STAFF)){ surv.getErrorMessages().add("Surveillance must have authority for " + Authority.ROLE_ONC_STAFF + " or " + Authority.ROLE_ACB_ADMIN); } else if(surv.getAuthority().equalsIgnoreCase(Authority.ROLE_ONC_STAFF) && !hasOncStaff){ surv.getErrorMessages().add("User must have authority " + Authority.ROLE_ONC_STAFF); } } }</code><technical_language>This function some issues. 1. A user multiple ROLEs, if do, call create a surveillance pass in ROLE, chosen user activity. Assuming ROLE is of correct use, system passed in role. If of Authorized roles system return "Unauthorized" error. 2. CMS_STAFF ability do Surveillances. ROLEs allowed do stuff Surveillance. ROLE_ADMIN, ROLE_ACB_ADMIN, ROLE_ACB_STAFF. Of three, ROLE_ADMIN is allowed do everything, other ACB versions, allowed edit/delete a surveillance created ROLE_ADMIN 3. ROLE_ONC_STAFF all. ROLE is for viewing reports & downloading CMS file. ability edit modify listings</technical_language>

Target:
public void validateSurveillanceAuthority(Surveillance surv) { if(!StringUtils.isEmpty(surv.getAuthority())){ if(!surv.getAuthority().equalsIgnoreCase(Authority.ROLE_ADMIN) && !surv.getAuthority().equalsIgnoreCase(Authority.ROLE_ACB_ADMIN) && !surv.getAuthority().equalsIgnoreCase(Authority.ROLE_ACB_STAFF)){ surv.getErrorMessages().add("Surveillance must have authority for " + Authority.ROLE_ADMIN + " or " + Authority.ROLE_ACB_ADMIN + " or " + Authority.ROLE_ACB_STAFF); } } }
Source:
<code>protected Configuration createConfiguration(String name) throws Exception { FileConfiguration fc = new FileConfiguration(); fc.setPagingDirectory(getTestDir() + "/" + name + "/" + fc.getPagingDirectory()); fc.setLargeMessagesDirectory(getTestDir() + "/" + name + "/" + fc.getLargeMessagesDirectory()); fc.setJournalDirectory(getTestDir() + "/" + name + "/" + fc.getJournalDirectory()); fc.setBindingsDirectory(getTestDir() + "/" + name + "/" + fc.getBindingsDirectory()); addMqttTransportConfiguration(fc); addWildCardConfiguration(fc); <START> fc.setSecurityEnabled(true); <END> return fc; }</code><technical_language>Is enabling security necessary? this test simply exercising CRL functionality transport layer (i.e. SSL handshake) broker's security layer</technical_language>

Target:
protected Configuration createConfiguration(String name) throws Exception { Configuration configuration = createDefaultNettyConfig(); configuration.setPagingDirectory(getTestDir() + "/" + name + "/" + configuration.getPagingDirectory()); configuration.setLargeMessagesDirectory(getTestDir() + "/" + name + "/" + configuration.getLargeMessagesDirectory()); configuration.setJournalDirectory(getTestDir() + "/" + name + "/" + configuration.getJournalDirectory()); configuration.setBindingsDirectory(getTestDir() + "/" + name + "/" + configuration.getBindingsDirectory()); addMqttTransportConfiguration(configuration); addWildCardConfiguration(configuration); configuration.setSecurityEnabled(true); return configuration; }
Source:
<code>public boolean matchEvents() { if (!(fTraces.length > 0)) { return false; } initMatching(); for (int i = 0; i < fTraces.length; i++) { EventMatchingBuildRequest request = new EventMatchingBuildRequest(this, i); fTraces[i].sendRequest(request); try { request.waitForCompletion(); } catch (InterruptedException e) { <START> <END> } } finalizeMatching(); return true; }</code><technical_language>log exception, friend Sonar complain (Activator.log...)</technical_language>

Target:
public boolean matchEvents() { if (!(fTraces.length > 0)) { return false; } initMatching(); for (int i = 0; i < fTraces.length; i++) { EventMatchingBuildRequest request = new EventMatchingBuildRequest(this, i); fTraces[i].sendRequest(request); try { request.waitForCompletion(); } catch (InterruptedException e) { Activator.logInfo(e.getMessage()); } } finalizeMatching(); return true; }
Source:
<code>public boolean isThereAnInternalTraceBetween(EObject first, EObject second) { if (first.equals(second)) { return false; } else if (first instanceof INamed && second instanceof INamed) { <START> if (!first.eCrossReferences().isEmpty() && !second.eCrossReferences().isEmpty()) { <END> if (first.eCrossReferences().contains(second) || second.eCrossReferences().contains(first)) { return true; } } } return false; }</code><technical_language>eCrossReferences() return null? In case, get uncaught exception here</technical_language>

Target:
public boolean isThereAnInternalTraceBetween(EObject first, EObject second) { if (first.equals(second)) { return false; } else if (first instanceof INamed && second instanceof INamed) { if (first.eCrossReferences() != null && second.eCrossReferences() != null) { if (first.eCrossReferences().contains(second) || second.eCrossReferences().contains(first)) { return true; } } } return false; }