auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected Object encodeCommand(Command command) { <START> initDevicePassword(command, ""); <END> switch (command.getType()) { case Command.TYPE_CUSTOM: return encodeContent(command.getString(Command.KEY_DATA)); case Command.TYPE_ENGINE_STOP: return encodeContent("AT$IOGP3=1"); case Command.TYPE_ENGINE_RESUME: return encodeContent("AT$IOGP3=0"); default: Log.warning(new UnsupportedOperationException(command.getType())); break; } return null; }</code><technical_language>do need this line? I removed</technical_language>

Target:
protected Object encodeCommand(Command command) { switch (command.getType()) { case Command.TYPE_CUSTOM: return encodeContent(command.getString(Command.KEY_DATA)); case Command.TYPE_ENGINE_STOP: return encodeContent("AT$IOGP3=1"); case Command.TYPE_ENGINE_RESUME: return encodeContent("AT$IOGP3=0"); default: Log.warning(new UnsupportedOperationException(command.getType())); break; } return null; }
Source:
<code>protected Map<Long, Tuple2<Double, ColumnStatisticsImpl>> mergeResults( List<Tuple2<Long, Tuple2<Double, ColumnStatisticsImpl>>> tuples) throws StandardException{ Map<Long, ColumnStatisticsMerge> sm = new HashMap<>(); Map<Long, Double> sizeMap = new HashMap<>(); for (Tuple2<Long,Tuple2<Double, ColumnStatisticsImpl>> t : tuples) { Long conglomId = t._1; Double size = t._2._1; if (LOG.isDebugEnabled()) { <START> SpliceLogUtils.debug(LOG, "conglomerate=%d, size=%f", conglomId, size); <END> } ColumnStatisticsImpl cs = t._2._2; ColumnStatisticsMerge columnStatisticsMerge = sm.get(conglomId); if (columnStatisticsMerge == null) { columnStatisticsMerge = new ColumnStatisticsMerge(); sm.put(conglomId, columnStatisticsMerge); } columnStatisticsMerge.accumulate(cs); Double totalSize = sizeMap.get(conglomId); if (totalSize == null) totalSize = new Double(0); totalSize += size; if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "totalSize=%s", totalSize); } sizeMap.put(conglomId, totalSize); } Map<Long, Tuple2<Double, ColumnStatisticsImpl>> statisticsMap = new HashMap<>(); for (Long conglomId : sm.keySet()) { Double totalSize = sizeMap.get(conglomId); ColumnStatisticsImpl columnStatistics = sm.get(conglomId).terminate(); statisticsMap.put(conglomId, new Tuple2(totalSize, columnStatistics)); } return statisticsMap; }</code><technical_language>In addition changes, want change print format line 368 %s %f also: if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "totalSize=%s", totalSize); }</technical_language>

Target:
protected Map<Long, Tuple2<Double, ColumnStatisticsImpl>> mergeResults( List<Tuple2<Long, Tuple2<Double, ColumnStatisticsImpl>>> tuples) throws StandardException{ Map<Long, ColumnStatisticsMerge> sm = new HashMap<>(); Map<Long, Double> sizeMap = new HashMap<>(); for (Tuple2<Long,Tuple2<Double, ColumnStatisticsImpl>> t : tuples) { Long conglomId = t._1; Double size = t._2._1; if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "conglomerate=%d, size=%f", conglomId, size); } ColumnStatisticsImpl cs = t._2._2; ColumnStatisticsMerge columnStatisticsMerge = sm.get(conglomId); if (columnStatisticsMerge == null) { columnStatisticsMerge = new ColumnStatisticsMerge(); sm.put(conglomId, columnStatisticsMerge); } columnStatisticsMerge.accumulate(cs); Double totalSize = sizeMap.get(conglomId); if (totalSize == null) totalSize = new Double(0); totalSize += size; if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "totalSize=%f", totalSize); } sizeMap.put(conglomId, totalSize); } Map<Long, Tuple2<Double, ColumnStatisticsImpl>> statisticsMap = new HashMap<>(); for (Long conglomId : sm.keySet()) { Double totalSize = sizeMap.get(conglomId); ColumnStatisticsImpl columnStatistics = sm.get(conglomId).terminate(); statisticsMap.put(conglomId, new Tuple2(totalSize, columnStatistics)); } return statisticsMap; }
Source:
<code>public boolean checkDomainMetadataDevices(StorageDomain domain) { if (domain.getVgMetadataDevice() == null || domain.getFirstMetadataDevice() == null) { AuditLogable logable = new AuditLogableImpl(); <START> logable.setStorageDomainName(domain.getName()); <END> auditLogDirector.log(logable, AuditLogType.FAILED_DETERMINE_STORAGE_DOMAIN_METADATA_DEVICES); return false; } return true; }</code><technical_language>set storage domain id for correlation entity</technical_language>

Target:
public boolean checkDomainMetadataDevices(StorageDomain domain) { if (domain.getVgMetadataDevice() == null || domain.getFirstMetadataDevice() == null) { AuditLogable logable = new AuditLogableImpl(); logable.setStorageDomainName(domain.getName()); logable.setStorageDomainId(domain.getId()); auditLogDirector.log(logable, AuditLogType.FAILED_DETERMINE_STORAGE_DOMAIN_METADATA_DEVICES); return false; } return true; }
Source:
<code>private void fetchMediaList() { <START> if (!NetworkUtils.isNetworkAvailable(this)) { <END> return; } FetchMediaListPayload payload = new FetchMediaListPayload(mSite, MediaStore.DEFAULT_NUM_MEDIA_PER_FETCH, false); mDispatcher.dispatch(MediaActionBuilder.newFetchMediaListAction(payload)); }</code><technical_language>a note here, I realized I usages of this approach check if network connectivity exists utilizing dispatcher. Do this is so</technical_language>

Target:
private void fetchMediaList() { if (!NetworkUtils.isNetworkAvailable(this)) { mNetworkErrorOnLastMediaFetchAttempt = true; return; } FetchMediaListPayload payload = new FetchMediaListPayload(mSite, MediaStore.DEFAULT_NUM_MEDIA_PER_FETCH, false); mDispatcher.dispatch(MediaActionBuilder.newFetchMediaListAction(payload)); }
Source:
<code>public F.Promise<Result> getHeaderViewModel() { <START> return F.Promise.pure(ok(views.html.HeaderViewModel.render( <END> _telemetryEnabled, _liveLoggingEnabled, _hostRegistryEnabled, _expressionsEnabled, _alertsEnabled))); }</code><technical_language>Please a features object pass render function. I a function takes a dozen boolean parameters. refactoring impossible</technical_language>

Target:
public F.Promise<Result> getHeaderViewModel() { return F.Promise.pure(ok(views.html.HeaderViewModel.render(_features))); }
Source:
<code>public boolean updateFragment(String fragmentId, boolean isGuaranteed) { synchronized (lock) { TaskWrapper taskWrapper = knownTasks.get(fragmentId); if (taskWrapper == null) { LOG.debug("Fragment not found {}", fragmentId); return false; } if (taskWrapper.isGuaranteed() == isGuaranteed) return true; LOG.debug("Fragment guaranteed state changed to {}; finishable {}, in wait queue {}, " + "in preemption queue {}", taskWrapper.getRequestId(), isGuaranteed, taskWrapper.canFinishForPriority(), taskWrapper.isInWaitQueue(), taskWrapper.isInPreemptionQueue()); if (taskWrapper.isInWaitQueue()) { boolean isRemoved = waitQueue.remove(taskWrapper); taskWrapper.updateIsGuaranteed(isGuaranteed); forceReinsertIntoQueue(taskWrapper, isRemoved); } else { if (isGuaranteed) { removeFromPreemptionQueue(taskWrapper); <START> } else { <END> removeFromPreemptionQueue(taskWrapper); taskWrapper.updateIsGuaranteed(false); addToPreemptionQueue(taskWrapper); } } lock.notifyAll(); return true; } }</code><technical_language>avoid speculative wording confusion. I preemptable fine in this context</technical_language>

Target:
public boolean updateFragment(String fragmentId, boolean isGuaranteed) { synchronized (lock) { TaskWrapper taskWrapper = knownTasks.get(fragmentId); if (taskWrapper == null) { LOG.debug("Fragment not found {}", fragmentId); return false; } if (taskWrapper.isGuaranteed() == isGuaranteed) return true; LOG.debug("Fragment guaranteed state changed to {}; finishable {}, in wait queue {}, " + "in preemption queue {}", taskWrapper.getRequestId(), isGuaranteed, taskWrapper.canFinishForPriority(), taskWrapper.isInWaitQueue(), taskWrapper.isInPreemptionQueue()); if (isGuaranteed && taskWrapper.isInPreemptionQueue() && taskWrapper.canFinishForPriority()) { removeFromPreemptionQueue(taskWrapper); } if (taskWrapper.isInWaitQueue()) { boolean isRemoved = waitQueue.remove(taskWrapper); taskWrapper.updateIsGuaranteed(isGuaranteed); forceReinsertIntoQueue(taskWrapper, isRemoved); } else { taskWrapper.updateIsGuaranteed(isGuaranteed); if (!isGuaranteed && !taskWrapper.isInPreemptionQueue()) { addToPreemptionQueue(taskWrapper); } } lock.notifyAll(); return true; } }
Source:
<code>public GetSessionInfoResponse getSession(final String iccid) { <START> final GetSessionInfoRequest getSessionInfoRequest = WS_CLIENT_FACTORY.createGetSessionInfoRequest(); <END> getSessionInfoRequest.setLicenseKey(this.jasperWirelessTerminalAccess.getLicenseKey()); getSessionInfoRequest.setMessageId(this.correlationIdProviderService.getCorrelationId("messageID", iccid)); getSessionInfoRequest.setVersion(this.jasperWirelessTerminalAccess.getApiVersion()); getSessionInfoRequest.getIccid().add(iccid); for (final ClientInterceptor interceptor : this.webServiceTemplate.getInterceptors()) { if (interceptor instanceof Wss4jSecurityInterceptor) { setUsernameToken((Wss4jSecurityInterceptor) interceptor, this.jasperWirelessTerminalAccess.getUsername(), this.jasperWirelessTerminalAccess.getPassword()); } } this.webServiceTemplate.setDefaultUri(this.jasperWirelessTerminalAccess.getTerminalUri()); return (GetSessionInfoResponse) this.webServiceTemplate.marshalSendAndReceive(getSessionInfoRequest, new SoapActionCallback("<LINK_0>")); }</code><technical_language>While argument for theoretical advantages made, I code JAXB ObjectFactory useful effect creating new objects yet</technical_language>

Target:
public GetSessionInfoResponse getSession(final String iccid) { final GetSessionInfoRequest getSessionInfoRequest = WS_CLIENT_FACTORY.createGetSessionInfoRequest(); getSessionInfoRequest.setLicenseKey(this.jasperWirelessTerminalAccess.getLicenseKey()); getSessionInfoRequest.setMessageId(this.correlationIdProviderService.getCorrelationId("messageID", iccid)); getSessionInfoRequest.setVersion(this.jasperWirelessTerminalAccess.getApiVersion()); getSessionInfoRequest.getIccid().add(iccid); for (final ClientInterceptor interceptor : this.webServiceTemplate.getInterceptors()) { if (interceptor instanceof Wss4jSecurityInterceptor) { setUsernameToken((Wss4jSecurityInterceptor) interceptor, this.jasperWirelessTerminalAccess.getUsername(), this.jasperWirelessTerminalAccess.getPassword()); } } this.webServiceTemplate.setDefaultUri(this.jasperWirelessTerminalAccess.getUri()); return (GetSessionInfoResponse) this.webServiceTemplate.marshalSendAndReceive(getSessionInfoRequest, new SoapActionCallback("<LINK_0>")); }
Source:
<code>public AttemptResult<Void> process() { <START> if (stack == null || instanceMetaDataSet == null || instanceMetaDataSet.isEmpty()) { <END> return AttemptResults.breakFor("stack or instance data is empty"); } Optional<PollGroup> pollGroup = Optional.ofNullable(InMemoryStateStore.getStack(stack.getId())); if (pollGroup.isEmpty() || PollGroup.CANCELLED.equals(pollGroup.get())) { LOGGER.info("FreeIpa polling cancelled in inMemory store."); return AttemptResults.breakFor("FreeIpa polling cancelled in inMemory store"); } for (InstanceMetaData instanceMetaData : instanceMetaDataSet) { try { RPCResponse<Boolean> result = checkedMeasure(() -> freeIpaHealthDetailsService.checkFreeIpaHealth(stack, instanceMetaData), LOGGER, ":::Freeipa start::: FreeIPA health check ran in {}ms"); if (result.getResult()) { LOGGER.debug("Freeipa services are available and freeipa is working (on instance: {})", instanceMetaData.getInstanceId()); return AttemptResults.finishWith(null); } else { LOGGER.debug("Freeipa services are available, but freeipa is not working (on instance: {})", instanceMetaData.getInstanceId()); } } catch (Exception e) { LOGGER.debug("Freeipa services have not been available yet (on instance: {})", instanceMetaData.getInstanceId()); } } return AttemptResults.justContinue(); }</code><technical_language>check this in constructor in factory</technical_language>

Target:
public AttemptResult<Void> process() { Optional<PollGroup> pollGroup = Optional.ofNullable(InMemoryStateStore.getStack(stack.getId())); if (pollGroup.isEmpty() || PollGroup.CANCELLED.equals(pollGroup.get())) { LOGGER.info("FreeIpa polling cancelled in inMemory store."); return AttemptResults.breakFor("FreeIpa polling cancelled in inMemory store"); } for (InstanceMetaData instanceMetaData : instanceMetaDataSet) { try { RPCResponse<Boolean> result = checkedMeasure(() -> freeIpaHealthDetailsService.checkFreeIpaHealth(stack, instanceMetaData), LOGGER, ":::Freeipa start::: FreeIPA health check ran in {}ms"); if (result.getResult()) { LOGGER.debug("Freeipa services are available and freeipa is working (on instance: {})", instanceMetaData.getInstanceId()); return AttemptResults.finishWith(null); } else { LOGGER.debug("Freeipa services are available, but freeipa is not working (on instance: {})", instanceMetaData.getInstanceId()); } } catch (Exception e) { LOGGER.debug("Freeipa services have not been available yet (on instance: {})", instanceMetaData.getInstanceId()); } } return AttemptResults.justContinue(); }
Source:
<code>public ResponseEntity<String> update(@PathVariable("id") Long id, @RequestBody @Valid Counterparty counterparty) { Counterparty oldCounterparty = counterpartyDao.findOne(id); if (oldCounterparty == null) { throw new NotFoundException("Counterparty not found"); } counterparty.setId(id); <START> counterpartyDao.saveAndFlush(counterparty); <END> return new ResponseEntity<>("Counterparty updated", HttpStatus.NO_CONTENT); }</code><technical_language>check if Counterparty updated belongs logged AppUser</technical_language>

Target:
public ResponseEntity<String> update(@PathVariable("id") Long id, @RequestBody @Valid Counterparty counterparty) { Counterparty oldCounterparty = counterpartyDao.findOne(id); if (oldCounterparty == null) { throw new NotFoundException("Counterparty not found"); } AppUser loggedUser = userUtil.extractLoggedAppUserFromDatabase(); if(loggedUser.getUserId() != oldCounterparty.getUser().getUserId()){ throw new BadRequestException("Bad request!"); } counterparty.setUser(loggedUser); counterparty.setId(id); counterpartyDao.saveAndFlush(counterparty); return new ResponseEntity<>("Counterparty updated", HttpStatus.NO_CONTENT); }
Source:
<code>public void generateAlarms() { int warning = Integer.parseInt(sp.getString("notification_warning", "3")); AccountDataSource data = new AccountDataSource(app); data.open(); List<LentItem> items = data.getAllLentItems(); Map<LocalDate, List<Long>> arrangedIds = new HashMap<>(); for (LentItem item : items) { LocalDate deadline = item.getDeadline(); if (!arrangedIds.containsKey(deadline)) { arrangedIds.put(deadline, new ArrayList<Long>()); } arrangedIds.get(deadline).add(item.getDbId()); } for (Alarm alarm : data.getAllAlarms()) { if (!arrangedIds.containsKey(alarm.deadline)) { data.removeAlarm(alarm); } } for (Map.Entry<LocalDate, List<Long>> entry : arrangedIds.entrySet()) { LocalDate deadline = entry.getKey(); <START> long[] media = toArray(entry.getValue()); <END> Alarm alarm = data.getAlarmByDeadline(deadline); if (alarm != null) { if (!Arrays.equals(media, alarm.media)) { alarm.media = media; data.updateAlarm(alarm); } } else { if (BuildConfig.DEBUG) { Log.i("OpacClient", "scheduling alarm for " + media.length + " items with deadline on " + DateTimeFormat.shortDate().print(deadline) + " on " + DateTimeFormat.shortDate().print(deadline.minusDays(warning))); } data.addAlarm(deadline, media, deadline.minusDays(warning).toDateTimeAtStartOfDay()); } } data.close(); scheduleAlarms(); }</code><technical_language>comma-separated strings in database: Is a way? "normalized" tables: alarm, lent_item, lent_item_on_alarm. I is overkill do need features of relational databases. > expired items displayed in notification in a order time notification is shown Well, sort display time. > if changed List<LentItem> List<ReservedItem> in AccountData class Sets, confusing order change time user re-opens refreshes account view. right that, I suggestion back. other hand, this "convert array, Array.equals" compares order-sensitive. a Set instead of array here</technical_language>

Target:
public void generateAlarms() { generateAlarms(-1, null); }
Source:
<code>protected boolean isValidVersion(WorkflowVersion version) { SortedSet<VersionValidation> versionValidations = version.getValidations(); boolean isValid = true; <START> for (VersionValidation versionValidation : versionValidations) { <END> if (!versionValidation.isValid()) { isValid = false; break; } } return isValid; }</code><technical_language>Trivial lambda</technical_language>

Target:
protected boolean isValidVersion(WorkflowVersion version) { return !version.getValidations().stream().filter(Validation -> !Validation.isValid()).findFirst().isPresent(); }
Source:
<code>private void sendMessage(final RawData message, final Connection connection, final DTLSSession session) { try { LOGGER.trace("send {}-{} using {}-{}", connection.getConnectionId(), connection.getPeerAddress(), session.getSessionIdentifier(), session.getPeer()); final EndpointContext ctx = session.getConnectionWriteContext(); if (!checkOutboundEndpointContext(message, ctx)) { return; } message.onContextEstablished(ctx); Record record = new Record( ContentType.APPLICATION_DATA, session.getWriteEpoch(), session.getSequenceNumber(), new ApplicationMessage(message.getBytes(), message.getInetSocketAddress()), session, true, TLS12_CID_PADDING); sendRecord(record); message.onSent(); connection.refreshAutoResumptionTime(); } catch (IOException e) { message.onError(e); } catch (GeneralSecurityException e) { <START> DROP_LOGGER.debug("Cannot send APPLICATION record to peer [{}]", message.getInetSocketAddress(), e); <END> message.onError(e); } }</code><technical_language>this is more a Debug ? a warn</technical_language>

Target:
private void sendMessage(final RawData message, final Connection connection, final DTLSSession session) { try { LOGGER.trace("send {}-{} using {}-{}", connection.getConnectionId(), connection.getPeerAddress(), session.getSessionIdentifier(), session.getPeer()); final EndpointContext ctx = session.getConnectionWriteContext(); if (!checkOutboundEndpointContext(message, ctx)) { return; } message.onContextEstablished(ctx); Record record = new Record( ContentType.APPLICATION_DATA, session.getWriteEpoch(), session.getSequenceNumber(), new ApplicationMessage(message.getBytes(), message.getInetSocketAddress()), session, true, TLS12_CID_PADDING); sendRecord(record); message.onSent(); connection.refreshAutoResumptionTime(); } catch (IOException e) { message.onError(e); } catch (GeneralSecurityException e) { DROP_LOGGER.warn("Cannot send APPLICATION record to peer [{}]", message.getInetSocketAddress(), e); message.onError(e); } }
Source:
<code>void createSymbolsFromWildcardImport(Set<Symbol> importedSymbols, ImportFrom importFrom, Map<String, Symbol> globalSymbolsByFQN) { importedSymbols.forEach(symbol -> { Symbol importedSymbol = copySymbol(symbol.name(), symbol, globalSymbolsByFQN); if (!isExistingSymbol(importedSymbol.name())) { symbols.add(importedSymbol); <START> symbolsByName.put(symbol.name(), importedSymbol); <END> } else { SymbolImpl originalSymbol = resolve(symbol.name()); if (originalSymbol != null) { resetSymbolInfo(importedSymbol.fullyQualifiedName(), originalSymbol); originalSymbol.addUsage(importFrom, Usage.Kind.IMPORT); } } }); }</code><technical_language>add usage in this case</technical_language>

Target:
void createSymbolsFromWildcardImport(Set<Symbol> importedSymbols, ImportFrom importFrom, Map<String, Symbol> globalSymbolsByFQN) { importedSymbols.forEach(symbol -> { Symbol importedSymbol = copySymbol(symbol.name(), symbol, globalSymbolsByFQN); if (!isExistingSymbol(importedSymbol.name())) { symbols.add(importedSymbol); symbolsByName.put(symbol.name(), importedSymbol); ((SymbolImpl) importedSymbol).addUsage(importFrom, Usage.Kind.IMPORT); } else { SymbolImpl originalSymbol = resolve(symbol.name()); if (originalSymbol != null) { resetSymbolInfo(importedSymbol.fullyQualifiedName(), originalSymbol); originalSymbol.addUsage(importFrom, Usage.Kind.IMPORT); } } }); }
Source:
<code>public void run() { m_verbotenThreads.add(Thread.currentThread().getId()); try { m_ih.starting(this); m_ih.started(this); while (m_shouldStop == false) { LatencyWatchdog.pet(); if (m_hadWork) { m_selector.selectNow(); } else { m_selector.select(); } m_hadWork = false; Runnable task = null; while ((task = m_tasks.poll()) != null) { m_hadWork = true; task.run(); } dispatchReadStream(); drainWriteStream(); } } catch (CancelledKeyException e) { networkLog.warn( "Had a cancelled key exception for " + m_threadName, e); } catch (IOException e) { final String trimmed = e.getMessage() == null ? "" : e.getMessage().trim(); if ((e instanceof IOException && (trimmed.equalsIgnoreCase("Connection reset by peer") || trimmed.equalsIgnoreCase("broken pipe"))) || e instanceof AsynchronousCloseException || e instanceof ClosedChannelException || e instanceof ClosedByInterruptException) { if (m_logger.isDebugEnabled()) { m_logger.debug( "PicoNetwork died, probably of natural causes", e); } } else { e.printStackTrace(); networkLog.error( "PicoNetwork died due to an unexpected exception", e); } } catch (Throwable ex) { <START> ex.printStackTrace(); <END> m_logger.error(null, ex); m_shouldStop = true; } finally { m_verbotenThreads.remove(Thread.currentThread().getId()); try { p_shutdown(); } catch (Throwable t) { m_logger.error("Error shutting down Volt Network", t); t.printStackTrace(); } } }</code><technical_language>stack trace printing removed in this class</technical_language>

Target:
public void run() { m_verbotenThreads.add(Thread.currentThread().getId()); try { m_ih.starting(this); m_ih.started(this); while (m_shouldStop == false) { LatencyWatchdog.pet(); if (m_hadWork) { m_selector.selectNow(); } else { m_selector.select(); } m_hadWork = false; Runnable task = null; while ((task = m_tasks.poll()) != null) { m_hadWork = true; task.run(); } dispatchReadStream(); drainWriteStream(); } } catch (CancelledKeyException e) { networkLog.warn( "Had a cancelled key exception for " + m_threadName, e); } catch (IOException e) { final String trimmed = e.getMessage() == null ? "" : e.getMessage().trim(); if ((e instanceof IOException && (trimmed.equalsIgnoreCase("Connection reset by peer") || trimmed.equalsIgnoreCase("broken pipe"))) || e instanceof AsynchronousCloseException || e instanceof ClosedChannelException || e instanceof ClosedByInterruptException) { if (m_logger.isDebugEnabled()) { m_logger.debug( "PicoNetwork died, probably of natural causes", e); } } else { networkLog.error( "PicoNetwork died due to an unexpected exception", e); } } catch (Throwable ex) { m_logger.error(null, ex); m_shouldStop = true; } finally { m_verbotenThreads.remove(Thread.currentThread().getId()); try { p_shutdown(); } catch (Throwable t) { m_logger.error("Error shutting down Volt Network", t); } } }
Source:
<code>public ResponseEntity<?> getSchemas( @PathVariable("name") final String name, @RequestParam(value = "offset", required = false, defaultValue = "0") final int offset, @RequestParam(value = "limit", required = false, defaultValue = "20") final int limit, <START> final NativeWebRequest request) throws InvalidLimitException { <END> final EventType eventType = eventTypeService.get(name); final PaginationWrapper schemas = schemaService.getSchemas(name, offset, limit); return ResponseEntity.status(HttpStatus.OK).body(schemas); }</code><technical_language>eventTypeService.get throw other exceptions</technical_language>

Target:
public ResponseEntity<?> getSchemas( @PathVariable("name") final String name, @RequestParam(value = "offset", required = false, defaultValue = "0") final int offset, @RequestParam(value = "limit", required = false, defaultValue = "20") final int limit, final NativeWebRequest request) throws InvalidLimitException, NoSuchEventTypeException, InternalNakadiException { final EventType eventType = eventTypeService.get(name); final PaginationWrapper schemas = schemaService.getSchemas(name, offset, limit); return ResponseEntity.status(HttpStatus.OK).body(schemas); }
Source:
<code>protected void recordCapabilitiesAndRequirements(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { super.recordCapabilitiesAndRequirements(context, operation, resource); <START> ModelNode defaultTracer = DEFAULT_TRACER.resolveModelAttribute(context, operation); <END> if (defaultTracer.isDefined()) { context.registerCapability(RuntimeCapability.Builder.of(DEFAULT_TRACER_CAPABILITY.getDynamicName(defaultTracer.asString()), false).build()); } }</code><technical_language>I want call super implementation, handling capability registration conditionally</technical_language>

Target:
protected void recordCapabilitiesAndRequirements(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException { ModelNode defaultTracer = DEFAULT_TRACER.resolveModelAttribute(context, operation); if (defaultTracer.isDefined()) { context.registerCapability(DEFAULT_TRACER_CAPABILITY); } }
Source:
<code>public static ViewTypes getViewType(String viewName) { switch (viewName) { case TOKENS: case LEMMA: case POS: case VERB_SENSE: return ViewTypes.TOKEN_LABEL_VIEW; case SENTENCE: case PARAGRAPH: case MENTION_ACE: case MENTION_ERE: case NER_CONLL: case NER_ONTONOTES: case NER_ERE: case SHALLOW_PARSE: case QUANTITIES: case WIKIFIER: case CLAUSES_CHARNIAK: case CLAUSES_STANFORD: case CLAUSES_BERKELEY: case BROWN_CLUSTERS: case GAZETTEER: case TREE_GAZETTEER: case GAZETTEER_NE: case POST_ERE: case EVENT_ERE: return ViewTypes.SPAN_LABEL_VIEW; case DEPENDENCY: case DEPENDENCY_STANFORD: case DEPENDENCY_HEADFINDER: return ViewTypes.DEPENDENCY_VIEW; case PARSE_GOLD: case PARSE_CHARNIAK: case PARSE_CHARNIAK_KBEST: case PSEUDO_PARSE_CHARNIAK: case PARSE_STANFORD: case PARSE_STANFORD_KBEST: case PSEUDO_PARSE_STANFORD: case PARSE_BERKELEY: case PSEUDO_PARSE_BERKELEY: return ViewTypes.PARSE_VIEW; case SRL_VERB: case SRL_NOM: case SRL_PREP: case SRL_COMMA: return ViewTypes.PREDICATE_ARGUMENT_VIEW; case COREF: case COREF_HEAD: case COREF_EXTENT: case COREF_ERE: return ViewTypes.COREF_VIEW; <START> case TIMEX3: <END> } return null; }</code><technical_language>type of view TIMEX3 be? Right now, is of type NULL. Move case block contains correct view type</technical_language>

Target:
public static ViewTypes getViewType(String viewName) { switch (viewName) { case TOKENS: case LEMMA: case POS: case VERB_SENSE: return ViewTypes.TOKEN_LABEL_VIEW; case SENTENCE: case PARAGRAPH: case MENTION: case MENTION_ACE: case MENTION_ERE: case NER_CONLL: case NER_ONTONOTES: case NER_ERE: case SHALLOW_PARSE: case QUANTITIES: case WIKIFIER: case CLAUSES_CHARNIAK: case CLAUSES_STANFORD: case CLAUSES_BERKELEY: case BROWN_CLUSTERS: case GAZETTEER: case TREE_GAZETTEER: case GAZETTEER_NE: case POST_ERE: case EVENT_ERE: case TIMEX3: return ViewTypes.SPAN_LABEL_VIEW; case DEPENDENCY: case DEPENDENCY_STANFORD: case DEPENDENCY_HEADFINDER: return ViewTypes.DEPENDENCY_VIEW; case PARSE_GOLD: case PARSE_CHARNIAK: case PARSE_CHARNIAK_KBEST: case PSEUDO_PARSE_CHARNIAK: case PARSE_STANFORD: case PARSE_STANFORD_KBEST: case PSEUDO_PARSE_STANFORD: case PARSE_BERKELEY: case PSEUDO_PARSE_BERKELEY: return ViewTypes.PARSE_VIEW; case SRL_VERB: case SRL_NOM: case SRL_PREP: case SRL_COMMA: return ViewTypes.PREDICATE_ARGUMENT_VIEW; case COREF: case COREF_HEAD: case COREF_EXTENT: case COREF_ERE: return ViewTypes.COREF_VIEW; } return null; }
Source:
<code>public Curve apply(Curve curve) { <START> return ParallelShiftedCurve.builder().curve(curve).adjustment(adjustment).build(); <END> }</code><technical_language>of method</technical_language>

Target:
public Curve apply(Curve curve) { return ParallelShiftedCurve.of(curve, shiftType, shiftAmount); }
Source:
<code>public void check(Options options) { <START> if ((options.curvePublicKey == null ^ options.curveSecretKey == null)) { <END> throw new IllegalStateException("Curve mechanism definition incomplete"); } if (options.curvePublicKey != null && options.curvePublicKey.length != Options.CURVE_KEYSIZE) { throw new IllegalStateException("Curve mechanism definition incomplete"); } if (options.curveSecretKey != null && options.curveSecretKey.length != Options.CURVE_KEYSIZE) { throw new IllegalStateException("Curve mechanism definition incomplete"); } if (!options.asServer && options.curveServerKey == null) { throw new IllegalStateException("Curve mechanism definition incomplete"); } }</code><technical_language>a typo. If XOR is purpose, is coupled line checking asServer flag. is readable straight-forward logic, ATM</technical_language>

Target:
public void check(Options options) { }
Source:
<code>private List<String> getAdmins() throws KeeperException { <START> String adminsPath = "/" + zkNamespace + "/" + XD_ADMINS; <END> List<String> results = new ArrayList<String>(); try { Stat stat = zk.exists(adminsPath, false); if (stat != null) { List<String> admins = zk.getChildren(adminsPath, false); for (String admin : admins) { Stat dataStat = new Stat(); byte[] data = zk.getData(adminsPath + "/" + admin, false, dataStat); try { HashMap<String,Object> dataValues = new ObjectMapper().readValue(new String(data), HashMap.class); results.add("http://" + dataValues.get("host") + ":" + dataValues.get("port")); } catch (IOException e) } } } catch (InterruptedException ignore) return results; }</code><technical_language>Worth check support slashes in namespace? If this break double slash if zk barks of it</technical_language>

Target:
private List<String> getAdmins() throws KeeperException { String adminsPath = "/" + zkNamespace + "/" + XD_ADMINS; List<String> results = new ArrayList<String>(); try { Stat stat = zk.exists(adminsPath, false); if (stat != null) { List<String> admins = zk.getChildren(adminsPath, false); for (String admin : admins) { byte[] data = zk.getData(adminsPath + "/" + admin, false, null); try { HashMap<String,Object> dataValues = new ObjectMapper().readValue(new String(data), HashMap.class); results.add("http://" + dataValues.get("host") + ":" + dataValues.get("port")); } catch (IOException e) { Log.error("IOException while retrieving data for " + admin + ": " + e.getMessage()); } } } } catch (InterruptedException ignore) return results; }
Source:
<code>public GZIPRequestStream(HttpServletRequest request) throws IOException { super(); closed = false; this.request = request; this.input = request.getInputStream(); this.zipInput = new GZIPInputStream(input); <START> bufferedOutput = new ByteArrayOutputStream(); <END> }</code><technical_language>remove</technical_language>

Target:
public GZIPRequestStream(HttpServletRequest request) throws IOException { super(); this.zipInput = new GZIPInputStream(request.getInputStream()); }
Source:
<code>public void testCRCChecksum() throws Exception { EventDeserializer eventDeserializer = new EventDeserializer(); BinaryLogFileReader reader = new BinaryLogFileReader( <START> new FileInputStream("/data/mysql-bin.000001"), eventDeserializer); <END> readAll(reader, 303); }</code><technical_language>test data reside in src/test/resources/</technical_language>

Target:
public void testCRCChecksum() throws Exception { EventDeserializer eventDeserializer = new EventDeserializer(); BinaryLogFileReader reader = new BinaryLogFileReader( new FileInputStream("src/test/resources/mysql-bin.000001"), eventDeserializer); readAll(reader, 303); }
Source:
<code>private MavenSettingsConfig createSettings(MavenSettingsConfigProvider provider) throws Exception { CredentialsStore store = CredentialsProvider.lookupStores(j.getInstance()).iterator().next(); store.addCredentials(Domain.global(), new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "credid", "dummy desc", "foo", "bar")); ServerCredentialMapping mapping = new ServerCredentialMapping("myserver", "credid"); List<ServerCredentialMapping> mappings = new ArrayList<ServerCredentialMapping>(); mappings.add(mapping); <START> MavenSettingsConfig c1 = (MavenSettingsConfig) provider.newConfig(null); <END> MavenSettingsConfig c2 = new MavenSettingsConfig(c1.id + "dummy", c1.name, c1.comment, c1.content, MavenSettingsConfig.isReplaceAllDefault, mappings); provider.save(c2); return c2; }</code><technical_language>This arg is non-null</technical_language>

Target:
private MavenSettingsConfig createSettings(MavenSettingsConfigProvider provider) throws Exception { CredentialsStore store = CredentialsProvider.lookupStores(j.getInstance()).iterator().next(); store.addCredentials(Domain.global(), new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "credid", "dummy desc", "foo", "bar")); ServerCredentialMapping mapping = new ServerCredentialMapping("myserver", "credid"); List<ServerCredentialMapping> mappings = new ArrayList<ServerCredentialMapping>(); mappings.add(mapping); MavenSettingsConfig c1 = (MavenSettingsConfig) provider.newConfig(String.valueOf(System.currentTimeMillis())); MavenSettingsConfig c2 = new MavenSettingsConfig(c1.id + "dummy", c1.name, c1.comment, c1.content, MavenSettingsConfig.isReplaceAllDefault, mappings); provider.save(c2); return c2; }
Source:
<code><START> private static Value base64encode(byte[] data, String algorithm) { final EncodingAlgorithm algorithmImpl = EncodingFactory.getEncodingAlgorithm(algorithm); final String result = algorithmImpl.encode(data); return ValueVarchar.get(result); } <END></code><technical_language>Please, inline this method, additional classes for a small function needed</technical_language>

Target:
private static Value base64encode(byte[] data, String algorithm) { if (data!=null){ final String result; if (algorithm == null || algorithm.isEmpty() || "BASE64".equalsIgnoreCase(algorithm)) { result = Base64.getEncoder().encodeToString(data); } else if ("URL".equalsIgnoreCase(algorithm)) { result = Base64.getUrlEncoder().encodeToString(data); } else { throw DbException.getInvalidValueException("algorithmString, valid value: 'BASE64' or not set, 'URL'", algorithm); } return ValueVarchar.get(result); }else{ return ValueNull.INSTANCE; } }
Source:
<code>private void configureModuleConverters(String contentTypeString, Module module, boolean isInput) { if (logger.isDebugEnabled()) { logger.debug("module " + (isInput ? "input" : "output") + "Type is " + contentTypeString); } SimpleModule sm = (SimpleModule) module; try { MimeType contentType = resolveContentType(contentTypeString, module); AbstractMessageChannel channel = getChannel(module, isInput); CompositeMessageConverter converters = null; try { converters = converterFactory.newInstance(contentType); } catch (ConversionException e) { throw new ModuleConfigurationException(e.getMessage() + "(" + module.getName() + " --" + (isInput ? "input" : "output") + "Type=" + contentTypeString + ")"); } Class<?> dataType = MessageConverterUtils.getJavaTypeForContentType(contentType, sm.getApplicationContext().getClassLoader()); if (dataType == null) { throw new ModuleConfigurationException("Content type is not supported for " + module.getName() + " --" + (isInput ? "input" : "output") + "Type=" + contentTypeString); } else { channel.setDatatypes(dataType); channel.setMessageConverter(converters); } <START> if (this.pretty_print == true) { <END> if ("application/json".equals(contentTypeString)) { for (MessageConverter messageConverter : converters.getConverters()) { if (messageConverter instanceof PojoToJsonMessageConverter) { ((PojoToJsonMessageConverter) messageConverter).setPrettyPrint(true); } else if (messageConverter instanceof TupleToJsonMessageConverter) { ((TupleToJsonMessageConverter) messageConverter).setPrettyPrint(true); } } } } } catch (Throwable t) { throw new ModuleConfigurationException(t.getMessage(), t); } }</code><technical_language>This feel right **at all**. prettyPrint injection converter level, plugin level</technical_language>

Target:
private void configureModuleConverters(String contentTypeString, Module module, boolean isInput) { if (logger.isDebugEnabled()) { logger.debug("module " + (isInput ? "input" : "output") + "Type is " + contentTypeString); } SimpleModule sm = (SimpleModule) module; try { MimeType contentType = resolveContentType(contentTypeString, module); AbstractMessageChannel channel = getChannel(module, isInput); CompositeMessageConverter converters = null; try { converters = converterFactory.newInstance(contentType); } catch (ConversionException e) { throw new ModuleConfigurationException(e.getMessage() + "(" + module.getName() + " --" + (isInput ? "input" : "output") + "Type=" + contentTypeString + ")"); } Class<?> dataType = MessageConverterUtils.getJavaTypeForContentType(contentType, sm.getApplicationContext().getClassLoader()); if (dataType == null) { throw new ModuleConfigurationException("Content type is not supported for " + module.getName() + " --" + (isInput ? "input" : "output") + "Type=" + contentTypeString); } else { channel.setDatatypes(dataType); channel.setMessageConverter(converters); } } catch (Throwable t) { throw new ModuleConfigurationException(t.getMessage(), t); } }
Source:
<code>private void onAsyncExecutionFailure(String reason) { mLastExecutionStatus = STATUS_FAILED; if (mActivity != null) { <START> Logger.log(LogTypes.TYPE_MAINTENANCE, String.format( <END> "%s failed with %s for recovery measure %s", mCurrentMeasure.getType(), reason, mCurrentMeasure.getSequenceNumber())); mActivity.disableLoadingIndicator(); mActivity.enableRetry(); } }</code><technical_language>double chekcing, "mActivity is null", right? mCurrentMeasure? is mCurrentMeasure coming null mActivity is null</technical_language>

Target:
private void onAsyncExecutionFailure(String reason) { try { mLastExecutionStatus = STATUS_FAILED; Logger.log(LogTypes.TYPE_MAINTENANCE, String.format( "%s failed with %s for recovery measure %s", mCurrentMeasure.getType(), reason, mCurrentMeasure.getSequenceNumber())); if (mActivity != null) { mActivity.disableLoadingIndicator(); mActivity.enableRetry(); } } catch (Exception e) { handleException(e); } }
Source:
<code>public static boolean checkImagesConfiguration(Guid storageDomainId, Collection<? extends Disk> disksConfigList, List<String> messages) { StorageDomainStatic storageDomain = DbFacade.getInstance().getStorageDomainStaticDao().get(storageDomainId); return <START> !disksConfigList.stream().filter(disk -> DiskStorageType.IMAGE == disk.getDiskStorageType()) <END> .anyMatch(disk -> !checkImageConfiguration(storageDomain, (DiskImage) disk, messages)); }</code><technical_language>Please reuse DiskFilters#IMAGES_ONLY</technical_language>

Target:
public static boolean checkImagesConfiguration(Guid storageDomainId, Collection<? extends Disk> disksConfigList, List<String> messages) { StorageDomainStatic storageDomain = DbFacade.getInstance().getStorageDomainStaticDao().get(storageDomainId); return !disksConfigList.stream().filter(DisksFilter.ONLY_IMAGES) .anyMatch(disk -> !checkImageConfiguration(storageDomain, (DiskImage) disk, messages)); }
Source:
<code>public String getMaxConnections() { return maxConnections == null <START> ? Integer.valueOf(DEFAULT_CONNECTIONS).toString() <END> : maxConnections; }</code><technical_language>String.valueOf(DEFAULT_CONNECTIONS) more straightforward</technical_language>

Target:
public String getMaxConnections() { return maxConnections == null ? String.valueOf(DEFAULT_CONNECTIONS) : maxConnections; }
Source:
<code>public void test002_CreateBadTree() throws <START> IOException { <END> expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Can't append a tree entry with zero-length name"); final TreeFormatter formatter = new TreeFormatter(); formatter.append("", FileMode.TREE, ObjectId.fromString("4b825dc642cb6eb9a060e54bf8d69288fbee4904")); }</code><technical_language>Eclipse is giving error this is thrown. Changing Exception fixes it</technical_language>

Target:
public void test002_CreateBadTree() throws Exception { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage(JGitText.get().invalidTreeZeroLengthName); final TreeFormatter formatter = new TreeFormatter(); formatter.append("", FileMode.TREE, ObjectId.fromString("4b825dc642cb6eb9a060e54bf8d69288fbee4904")); }
Source:
<code>protected boolean canDoAction() { <START> if (getParameters().getClusterId() == null) { <END> addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID); return false; } if(!super.canDoAction()) { return false; } return true; }</code><technical_language>command line user provide a wrong id (say, mistake), check for getVdsGroup() == null</technical_language>

Target:
protected boolean canDoAction() { if (getParameters().getClusterId() == null || getVdsGroup() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID); return false; } if(!super.canDoAction()) { return false; } return true; }
Source:
<code>private void checkYearInFile( File gplFile ) throws FileNotFoundException { try ( Scanner scanner = new Scanner( gplFile ) ) { <START> scanner.nextLine(); END> String yearLine = scanner.nextLine(); Pattern p = Pattern.compile( "Copyright © 2002-(\\d\\d\\d\\d) Network Engine for Objects in Lund AB" ); Matcher m = p.matcher( yearLine ); if ( m.find() ) { String yearInFile = m.group( 1 ); int realYear = Calendar.getInstance().get( Calendar.YEAR ); assertThat( Integer.parseInt( yearInFile ), equalTo( realYear ) ); } else { fail( "No year found in NOTICE header!" ); } } }</code><technical_language>Is some "official build" parameter flag use? for packaging builds, generally false else</technical_language>

Target:
private void checkYearInFile( File gplFile ) throws FileNotFoundException { try ( Scanner scanner = new Scanner( gplFile ) ) { scanner.nextLine(); String yearLine = scanner.nextLine(); Pattern p = Pattern.compile( "Copyright © 2002-(\\d\\d\\d\\d) Network Engine for Objects in Lund AB" ); Matcher m = p.matcher( yearLine ); if ( m.find() ) { String yearInFile = m.group( 1 ); int realYear = Calendar.getInstance().get( Calendar.YEAR ); assertThat( "The year field in the NOTICE file header template needs to be updated. " + "If you are building an old version of Neo4j, and/or do not care about the copyright " + "year of its modules, set the maven parameter `-DignoreNoticeYear`", Integer.parseInt( yearInFile ), equalTo( realYear ) ); } else { fail( "No year found in NOTICE header!" ); } } }
Source:
<code>public void testValidURI() { <START> URI uri = URI.create("hello://localhost:9540"); <END> ClusteringServiceConfiguration serviceConfiguration = new ClusteringServiceConfiguration(uri); assertThat(serviceConfiguration.getClusterUri(), is(uri)); }</code><technical_language>I do change. Leave terracotta there</technical_language>

Target:
public void testValidURI() { URI uri = URI.create("terracotta://localhost:9540"); ClusteringServiceConfiguration serviceConfiguration = new ClusteringServiceConfiguration(uri); assertThat(serviceConfiguration.getClusterUri(), is(uri)); }
Source:
<code>public String getName() { <START> return "dijkstrabinosod|ch"; <END> }</code><technical_language>a more readable name dijkstrabi_no_sod</technical_language>

Target:
public String getName() { return "dijkstrabi|ch"; }
Source:
<code>public static Serializable fromBase64String(String base64String) { byte[] bytes = Base64.decode(base64String,0); Serializable object = null; try { ObjectInputStream objectInputStream = new ObjectInputStream( new ByteArrayInputStream(bytes) ); object = (Serializable)objectInputStream.readObject(); } catch (IOException e) { <START> e.printStackTrace(); <END> } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (ClassCastException e) { e.printStackTrace(); } return object; }</code><technical_language>Log for</technical_language>

Target:
public static Serializable fromBase64String(String base64String) { byte[] bytes = Base64.decode(base64String,0); Serializable object = null; try { ObjectInputStream objectInputStream = new ObjectInputStream( new ByteArrayInputStream(bytes) ); object = (Serializable)objectInputStream.readObject(); } catch (IOException e) { LogExt.e(SerializableUtils.class, e.getLocalizedMessage()); } catch (ClassNotFoundException e) { LogExt.e(SerializableUtils.class, e.getLocalizedMessage()); } catch (ClassCastException e) { LogExt.e(SerializableUtils.class, e.getLocalizedMessage()); } return object; }
Source:
<code>private List<DeviceAdmin> getSensesByAccountId(final Long accountId) { final ImmutableList<DeviceAccountPair> senseAccountPairs = deviceDAO.getSensesForAccountId(accountId); final List<DeviceAdmin> senses = new ArrayList<>(); for (final DeviceAccountPair senseAccountPair: senseAccountPairs) { final Optional<DeviceData> deviceDataOptional = sensorsViewsDynamoDB.lastSeen(senseAccountPair.externalDeviceId, accountId, senseAccountPair.internalDeviceId); if (!deviceDataOptional.isPresent()) { senses.add(DeviceAdmin.create(senseAccountPair)); } else { final DeviceData deviceData = deviceDataOptional.get(); <START> LOGGER.info("device data {}", deviceData); <END> senses.add(DeviceAdmin.create(senseAccountPair, DeviceStatus.sense(deviceData.deviceId, Integer.toHexString(deviceData.firmwareVersion), deviceData.dateTimeUTC))); } } return senses; }</code><technical_language>debug</technical_language>

Target:
private List<DeviceAdmin> getSensesByAccountId(final Long accountId) { final ImmutableList<DeviceAccountPair> senseAccountPairs = deviceDAO.getSensesForAccountId(accountId); final List<DeviceAdmin> senses = new ArrayList<>(); for (final DeviceAccountPair senseAccountPair: senseAccountPairs) { final Optional<DeviceData> deviceDataOptional = sensorsViewsDynamoDB.lastSeen(senseAccountPair.externalDeviceId, accountId, senseAccountPair.internalDeviceId); if (!deviceDataOptional.isPresent()) { senses.add(DeviceAdmin.create(senseAccountPair)); } else { final DeviceData deviceData = deviceDataOptional.get(); LOGGER.debug("device data {}", deviceData); senses.add(DeviceAdmin.create(senseAccountPair, DeviceStatus.sense(deviceData.deviceId, Integer.toHexString(deviceData.firmwareVersion), deviceData.dateTimeUTC))); } } return senses; }
Source:
<code>public void testRayCasting(){ final double[][] platform = {{ 59.8925348, 10.5242855}, { 59.8927012, 10.524743}, { 59.8926397, 10.5248089}, {59.8924888, 10.5243485}}; double[] testPointInside = { 59.8926474, 10.524729}; double[] testPointOutside = { 59.8925344, 10.5249007}; <START> assert(PlatformLinker.contains(platform, testPointInside)); <END> assert(!PlatformLinker.contains(platform, testPointOutside)); }</code><technical_language>nit: I prefer junit assertion functions</technical_language>

Target:
public void testRayCasting(){ final double[][] platform = {{10.5242855, 59.8925348}, {10.524743, 59.8927012}, { 10.5248089, 59.8926397}, {10.5243485, 59.8924888}}; double[] testPointInside = { 10.524729, 59.8926474}; double[] testPointOutside = { 10.5249007, 59.8925344}; assert(PlatformLinker.contains(platform, testPointInside)); assert(!PlatformLinker.contains(platform, testPointOutside)); }