auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void revertTasks() { if (getParameters().getRevertDbOperationScope() != null) { Guid destImageId = getParameters().getDestinationImageId(); RemoveImageParameters removeImageParams = new RemoveImageParameters(destImageId); removeImageParams.setParentParameters(removeImageParams); removeImageParams.setParentCommand(VdcActionType.RemoveImage); removeImageParams.setStorageDomainId(getParameters().getStorageDomainId()); removeImageParams.setDbOperationScope(getParameters().getRevertDbOperationScope()); removeImageParams.setEntityId(getDestinationImageId()); VdcReturnValueBase returnValue = checkAndPerformRollbackUsingCommand(VdcActionType.RemoveImage, removeImageParams); if (returnValue.getSucceeded()) { startPollingAsyncTasks(returnValue.getInternalTaskIdList()); } } }

Target:
protected void revertTasks() { if (getParameters().getRevertDbOperationScope() != null) { Guid destImageId = getParameters().getDestinationImageId(); RemoveImageParameters removeImageParams = new RemoveImageParameters(destImageId); removeImageParams.setParentParameters(removeImageParams); removeImageParams.setParentCommand(VdcActionType.RemoveImage); removeImageParams.setStorageDomainId(getParameters().getStorageDomainId()); removeImageParams.setDbOperationScope(getParameters().getRevertDbOperationScope()); removeImageParams.setEntityId(getDestinationImageId()); removeImageParams.setShouldLockImage(getParameters().getShouldLockImageOnRevert()); VdcReturnValueBase returnValue = checkAndPerformRollbackUsingCommand(VdcActionType.RemoveImage, removeImageParams); if (returnValue.getSucceeded()) { startPollingAsyncTasks(returnValue.getInternalTaskIdList()); } } }
Source:
public static boolean isSingleQxlDeviceLegal(DisplayType displayType, int osId, List<String> reasons, Version compatibilityVersion) { if (!Config.<Boolean> GetValue(ConfigValues.SingleQxlPciEnabled, compatibilityVersion.getValue())) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_INCOMPATIBLE_VERSION.toString()); return false; } if (displayType != DisplayType.qxl) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_DISPLAY_TYPE.toString()); return false; } if (!OsRepositoryImpl.INSTANCE.isSingleQxlDeviceEnabled(osId)) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_OS_TYPE.toString()); return false; } return true; }

Target:
public static boolean isSingleQxlDeviceLegal(DisplayType displayType, int osId, List<String> reasons, Version compatibilityVersion) { if (!FeatureSupported.singleQclPci(compatibilityVersion)) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_INCOMPATIBLE_VERSION.toString()); return false; } if (displayType != DisplayType.qxl) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_DISPLAY_TYPE.toString()); return false; } if (!OsRepositoryImpl.INSTANCE.isSingleQxlDeviceEnabled(osId)) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_SINGLE_DEVICE_OS_TYPE.toString()); return false; } return true; }
Source:
public void markRequestException(Error e) { String errorCode = e.getErrorCode().replace(":", "-"); metricsRegistry.meter(errorNamespace(metricNamespace, e, errorCode)).mark(); }

Target:
public void markRequestException(Error e) { String errorCode = e.getErrorCode().replaceAll(REGEX, "_"); metricsRegistry.meter(errorNamespace(metricNamespace, e, errorCode)).mark(); }
Source:
private static void checkPartitionStrategy( Schema schema, @Nullable PartitionStrategy strategy) { if (strategy == null) { return; } for (FieldPartitioner fp : strategy.getFieldPartitioners()) { if (fp instanceof ProvidedFieldPartitioner) { continue; } ValidationException.check(schema.getType() == Schema.Type.RECORD, "Cannot partition non-records: " + schema); Schema fieldSchema; try { fieldSchema = SchemaUtil.fieldSchema(schema, fp.getSourceName()); } catch (IllegalArgumentException e) { throw new ValidationException( "Cannot partition on " + fp.getSourceName(), e); } ValidationException.check( SchemaUtil.isConsistentWithExpectedType( fieldSchema.getType(), fp.getSourceType()), "Field type %s does not match partitioner %s", fieldSchema.getType(), fp); } }

Target:
private static void checkPartitionStrategy( Schema schema, @Nullable PartitionStrategy strategy) { if (strategy == null) { return; } for (FieldPartitioner fp : strategy.getFieldPartitioners()) { if (fp instanceof ProvidedFieldPartitioner) { continue; } ValidationException.check(schema.getType() == Schema.Type.RECORD, "Cannot partition non-records: %s", schema); Schema fieldSchema; try { fieldSchema = SchemaUtil.fieldSchema(schema, fp.getSourceName()); } catch (IllegalArgumentException e) { throw new ValidationException( "Cannot partition on " + fp.getSourceName(), e); } ValidationException.check( SchemaUtil.isConsistentWithExpectedType( fieldSchema.getType(), fp.getSourceType()), "Field type %s does not match partitioner %s", fieldSchema.getType(), fp); } }
Source:
private List<Service> lookupAllActiveLBServices(Service targetService) { Set<Service> lbServices = new HashSet<>(); List<Service> lbServicesForAccount = objectManager.find(Service.class, SERVICE.ACCOUNT_ID, targetService.getAccountId(), SERVICE.REMOVED, null, SERVICE.KIND, ServiceConstants.KIND_LOAD_BALANCER_SERVICE); for (Service lbService : lbServicesForAccount) { if (sdService.isActiveService(lbService)) { LbConfig lbConfig = DataAccessor.field(lbService, ServiceConstants.FIELD_LB_CONFIG, jsonMapper, LbConfig.class); if (lbConfig != null && lbConfig.getPortRules() != null) { for (PortRule rule : lbConfig.getPortRules()) { if (!StringUtils.isEmpty(rule.getServiceId()) && Long.valueOf(rule.getServiceId()).equals(targetService.getId())) { lbServices.add(lbService); } else { if (sdService.isSelectorLinkMatch(rule.getSelector(), targetService)) { lbServices.add(lbService); } if (sdService.isSelectorLinkMatch(targetService.getSelectorLink(), lbService)) { lbServices.add(lbService); } } } } } } return new ArrayList<Service>(lbServices); }

Target:
private List<Service> lookupAllActiveLBServices(Service targetService) { Map<Long, Service> lbServices = new HashMap<>(); List<Service> lbServicesForAccount = objectManager.find(Service.class, SERVICE.ACCOUNT_ID, targetService.getAccountId(), SERVICE.REMOVED, null, SERVICE.KIND, ServiceConstants.KIND_LOAD_BALANCER_SERVICE); for (Service lbService : lbServicesForAccount) { if (sdService.isActiveService(lbService)) { LbConfig lbConfig = DataAccessor.field(lbService, ServiceConstants.FIELD_LB_CONFIG, jsonMapper, LbConfig.class); if (lbConfig != null && lbConfig.getPortRules() != null) { for (PortRule rule : lbConfig.getPortRules()) { if (!StringUtils.isEmpty(rule.getServiceId()) && Long.valueOf(rule.getServiceId()).equals(targetService.getId())) { lbServices.put(lbService.getId(), lbService); } else { if (sdService.isSelectorLinkMatch(rule.getSelector(), targetService)) { lbServices.put(lbService.getId(), lbService); } if (sdService.isSelectorLinkMatch(targetService.getSelectorLink(), lbService)) { lbServices.put(lbService.getId(), lbService); } } } } } } return new ArrayList<Service>(lbServices.values()); }
Source:
private boolean isGptParamPresent(String key, String value) { waitForElementByElement(presentLeaderboard); String dataGptPageParams = presentLeaderboardGpt.getAttribute("data-gpt-page-params"); String gptParamPattern = '"' + key + '"' + ':' + '"' + value + '"'; PageObjectLogging.log( "GPT parameter search", "searching for: " + gptParamPattern + " in<br>" + dataGptPageParams, true ); return dataGptPageParams.contains(gptParamPattern); }

Target:
private boolean isGptParamPresent(String key, String value) { waitForElementByElement(presentLeaderboard); String dataGptPageParams = presentLeaderboardGpt.getAttribute("data-gpt-page-params"); String gptParamPattern = String.format("\"%s\":\"%s\"", key, value); PageObjectLogging.log( "GPT parameter search", "searching for: " + gptParamPattern + " in<br>" + dataGptPageParams, true ); return dataGptPageParams.contains(gptParamPattern); }
Source:
public synchronized FrameInsertionResult insertPacket(@NotNull Vp8Packet packet) { int pictureId = packet.getPictureId(); VP8Frame frame = frameHistory.get(pictureId); if (frame != null) { return doFrameInsert(frame, packet); } frame = new VP8Frame(packet); if (!frameHistory.insert(pictureId, frame)) return null; return new FrameInsertionResult(frame, true); }

Target:
public synchronized FrameInsertionResult insertPacket(@NotNull Vp8Packet packet) { int pictureId = packet.getPictureId(); VP8Frame frame = frameHistory.get(pictureId); if (frame != null) { return doFrameInsert(frame, packet); } frame = new VP8Frame(packet); if (!frameHistory.insert(pictureId, frame)) { return null; } return new FrameInsertionResult(frame, true); }
Source:
private void invokeValidatorsOnClass(List<Throwable> errors) { Annotation[] annotations = getTestClass().getAnnotations(); for (Annotation annotation : annotations) { if (hasValidatorAnnotation(annotation.annotationType())) { AnnotationValidator annotationValidator = getAnnotationValidator(annotation.annotationType()); annotationValidator.validateAnnotatedClass(getTestClass().getJavaClass(), errors); } } }

Target:
private void invokeValidatorsOnClass(List<Throwable> errors) { Annotation[] annotations = getTestClass().getAnnotations(); for (Annotation annotation : annotations) { Class<? extends Annotation> annotationType = annotation.annotationType(); ValidateWith validateWithAnnotation = annotationType.getAnnotation(ValidateWith.class); if (validateWithAnnotation != null) { AnnotationValidator annotationValidator = fAnnotationValidatorFactory.createAnnotationValidator(validateWithAnnotation); errors.addAll(annotationValidator.validateAnnotatedClass(getTestClass())); } } }
Source:
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Parameter parameter = (Parameter) o; if (!name.equals(parameter.name)) return false; if (!type.equals(parameter.type)) return false; if (value != null ? !value.equals(parameter.value) : parameter.value != null) return false; return true; }

Target:
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Parameter parameter = (Parameter) o; if (!name.equals(parameter.name)) return false; if (value != null ? !value.equals(parameter.value) : parameter.value != null) return false; return true; }
Source:
void imageIncoming(ImageReaderProxy imageReader) { synchronized (mLock) { if (mClosed) { return; } ImageProxy image; do { image = null; try { image = imageReader.acquireNextImage(); } catch (IllegalStateException e) { Log.e(TAG, "Failed to acquire latest image.", e); } finally { if (image != null) { mPendingImages.put(image.getTimestamp(), image); matchImages(); } } } while (image != null); } }

Target:
void imageIncoming(ImageReaderProxy imageReader) { synchronized (mLock) { if (mClosed) { return; } ImageProxy image; do { image = null; try { image = imageReader.acquireNextImage(); } catch (IllegalStateException e) { Log.e(TAG, "Failed to acquire next image.", e); } finally { if (image != null) { mPendingImages.put(image.getTimestamp(), image); matchImages(); } } } while (image != null); } }
Source:
private static void printHelp() { System.out.println("Supported commands: "); System.out.println("\tLIST <JOB_ID>"); System.out.println("\t\tList available traces/scenarios (supersteps/vertices) for a job"); System.out.println("\tDUMP <JOB_ID> <SUPERSTEP> <VERTEX>"); System.out.println("\t\tDump a trace in textual form"); System.out.println("\tMKTEST <JOB_ID> <SUPERSTEP> <VERTEX> [OUTPUT_PREFIX]"); System.out.println("\t\tGenerate a JUnit test case code from a trace. If an OUTPUT_PREFIX is " + "provided, a .java file is generated at the specified path."); System.exit(0); }

Target:
private static void printHelp() { LOG.info("Supported commands: "); LOG.info("\tlist <job_id>"); LOG.info("\t\tList available traces/scenarios (supersteps/vertices) for a job"); LOG.info("\tdump <job_id> <superstep> <vertex>"); LOG.info("\t\tDump a trace in textual form"); LOG.info("\tmktest <job_id> <superstep> <vertex> [output_prefix]"); LOG.info("\t\tGenerate a JUnit test case code from a trace. If an output_prefix is " + "provided, a .java file is generated at the specified path."); System.exit(0); }
Source:
public void run() { if (!this.plugin.isEnabled()) { return; } this.time = System.currentTimeMillis(); if (config.getBoolean("Properties.Earth.RevertEarthbending")) { try { this.returnFuture = this.plugin.getServer().getScheduler().callSyncMethod(this.plugin, new getOccupiedChunks(this.plugin.getServer())); final Set<HashMap<String,Integer>> chunks = this.returnFuture.get(); final Map<Block, Information> earth = new HashMap<>(EarthAbility.getMovedEarth()); for (final Block block : earth.keySet()) { if (earthRevertQueue.containsKey(block)) { continue; } final Information info = earth.get(block); HashMap<String, Integer> chunkcoord = new HashMap<>(); chunkcoord.put("x", block.getX() >> 4); chunkcoord.put("z", block.getZ() >> 4); if (this.time > (info.getTime() + config.getLong("Properties.Earth.RevertCheckTime")) && !(chunks.contains(chunkcoord) && safeRevert)) { this.addToRevertQueue(block); } } final Map<Integer, Information> air = new HashMap<>(EarthAbility.getTempAirLocations()); for (final Integer i : air.keySet()) { if (airRevertQueue.containsKey(i)) { continue; } final Information info = air.get(i); final Block block = info.getBlock(); HashMap<String, Integer> chunkcoord = new HashMap<>(); chunkcoord.put("x", block.getX() >> 4); chunkcoord.put("z", block.getZ() >> 4); if (this.time > (info.getTime() + config.getLong("Properties.Earth.RevertCheckTime")) && !(chunks.contains(chunkcoord) && safeRevert)) { this.addToAirRevertQueue(i); } } } catch (final Exception e) { e.printStackTrace(); } } }

Target:
public void run() { if (!this.plugin.isEnabled()) { return; } this.time = System.currentTimeMillis(); if (config.getBoolean("Properties.Earth.RevertEarthbending")) { try { this.returnFuture = this.plugin.getServer().getScheduler().callSyncMethod(this.plugin, new getOccupiedChunks(this.plugin.getServer())); final Set<Map<String,Integer>> chunks = this.returnFuture.get(); final Map<Block, Information> earth = new HashMap<>(EarthAbility.getMovedEarth()); for (final Block block : earth.keySet()) { if (earthRevertQueue.containsKey(block)) { continue; } final Information info = earth.get(block); Map<String, Integer> chunkcoord = new HashMap<>(); chunkcoord.put("x", block.getX() >> 4); chunkcoord.put("z", block.getZ() >> 4); if (this.time > (info.getTime() + config.getLong("Properties.Earth.RevertCheckTime")) && !(chunks.contains(chunkcoord) && safeRevert)) { this.addToRevertQueue(block); } } final Map<Integer, Information> air = new HashMap<>(EarthAbility.getTempAirLocations()); for (final Integer i : air.keySet()) { if (airRevertQueue.containsKey(i)) { continue; } final Information info = air.get(i); final Block block = info.getBlock(); Map<String, Integer> chunkcoord = new HashMap<>(); chunkcoord.put("x", block.getX() >> 4); chunkcoord.put("z", block.getZ() >> 4); if (this.time > (info.getTime() + config.getLong("Properties.Earth.RevertCheckTime")) && !(chunks.contains(chunkcoord) && safeRevert)) { this.addToAirRevertQueue(i); } } } catch (final Exception e) { e.printStackTrace(); } } }
Source:
public Response getPage(HttpServletRequest req, User user, String filter, boolean showArchived, int pageParam, int perPageParam) { return getPage(req, user, filter, showArchived, pageParam, perPageParam, "", (OrderDirection) null); }

Target:
public Response getPage(HttpServletRequest req, User user, String filter, boolean showArchived, int pageParam, int perPageParam) { return getPage(req, user, filter, showArchived, pageParam, perPageParam, StringUtils.EMPTY, (OrderDirection) null); }
Source:
public void addSong(PlaylistEntry entry) { int count = mPlaylist.countSongOccurence(entry); entry.setCount(count+1); mPlaylist.add(entry); if (isLocalPlayer) { mDataManager.addToLoadQueue(entry); } new BroadcastIntent(ACTION_SONG_ADDED) .putExtra(EXTRA_SONG, entry) .send(this); new BroadcastIntent(ACTION_PLAYLIST_UPDATED).send(this); if (isLocalPlayer) { getMessagingService().sendPlaylistMessage(mPlaylist.getSongsToPlay()); } else { getMessagingService().sendAddToPlaylistMessage(entry); } }

Target:
public void addSong(PlaylistEntry entry) { mPlaylist.add(entry); if (isLocalPlayer) { mDataManager.addToLoadQueue(entry); } new BroadcastIntent(ACTION_SONG_ADDED) .putExtra(EXTRA_SONG, entry) .send(this); new BroadcastIntent(ACTION_PLAYLIST_UPDATED).send(this); if (isLocalPlayer) { getMessagingService().sendPlaylistMessage(mPlaylist.getSongsToPlay()); } else { getMessagingService().sendAddToPlaylistMessage(entry); } }
Source:
public BulkMutation createBulkMutation(BigtableTableName tableName, AsyncExecutor asyncExecutor) { BulkOptions bulkOptions = options.getBulkOptions(); if (bulkOptions.isEnableBulkMutationThrottling()) { BulkMutationThrottling.throttle(resourceLimiter, bulkOptions.getBulkMutationRpcTargetMs()); } return new BulkMutation( tableName, asyncExecutor, options.getRetryOptions(), BigtableSessionSharedThreadPools.getInstance().getRetryExecutor(), bulkOptions.getBulkMaxRowKeyCount(), bulkOptions.getBulkMaxRequestSize(), bulkOptions.getAutoflushMs()); }

Target:
public BulkMutation createBulkMutation(BigtableTableName tableName, AsyncExecutor asyncExecutor) { BulkOptions bulkOptions = options.getBulkOptions(); if (bulkOptions.isEnableBulkMutationThrottling()) { resourceLimiter.throttle(bulkOptions.getBulkMutationRpcTargetMs()); } return new BulkMutation( tableName, asyncExecutor, options.getRetryOptions(), BigtableSessionSharedThreadPools.getInstance().getRetryExecutor(), bulkOptions.getBulkMaxRowKeyCount(), bulkOptions.getBulkMaxRequestSize(), bulkOptions.getAutoflushMs()); }
Source:
public String getErrorMessage() { return getMessages().customPropertiesValuesShouldBeInFormatReason(getKeyValueFormatMessage()); }

Target:
public String getErrorMessage() { return getMessages().customPropertiesValuesShouldBeInFormatReason(FORMAT); }
Source:
public List<String> removeSavedPlainCommands() { if (saved.isEmpty()) { return Collections.emptyList(); } synchronized (saved) { List<String> result = new ArrayList<>(saved); saved.removeAll(result); if (result.isEmpty()) { log.info("{} commands are removed from saved list", result.size()); } return result; } }

Target:
public List<String> removeSavedPlainCommands() { if (saved.isEmpty()) { return Collections.emptyList(); } List<String> result = new ArrayList<>(saved); saved.clear(); if (!result.isEmpty()) { log.info("{} commands are removed from saved list", result.size()); } return result; }
Source:
protected FileSystemElement createElement(FileSystemElement parent, Object fileSystemObject, int depth) throws InterruptedException { ModalContext.checkCanceled(monitor); boolean isContainer = provider.isFolder(fileSystemObject); String elementLabel = parent == null ? provider.getFullPath(fileSystemObject) : provider.getLabel(fileSystemObject); MinimizedFileSystemElement result = new MinimizedFileSystemElement( elementLabel, parent, isContainer); result.setFileSystemObject(fileSystemObject); if (isContainer) { if (depth > 0) { List children = provider.getChildren(fileSystemObject); if (children == null) { children = new ArrayList(1); } Iterator childrenEnum = children.iterator(); while (childrenEnum.hasNext()) { createElement(result, childrenEnum.next(), depth - 1); } result.setPopulated(); } } return result; }

Target:
protected FileSystemElement createElement(FileSystemElement parent, Object fileSystemObject, int depth) throws InterruptedException { ModalContext.checkCanceled(monitor); boolean isContainer = provider.isFolder(fileSystemObject); String elementLabel = parent == null ? provider.getFullPath(fileSystemObject) : provider.getLabel(fileSystemObject); MinimizedFileSystemElement result = new MinimizedFileSystemElement( elementLabel, parent, isContainer); result.setFileSystemObject(fileSystemObject); if (isContainer && depth > 0) { List children = provider.getChildren(fileSystemObject); if (children != null) { Iterator childrenEnum = children.iterator(); while (childrenEnum.hasNext()) { createElement(result, childrenEnum.next(), depth - 1); } } result.setPopulated(); } return result; }
Source:
public boolean close() { if (fetchResultImage != null) fetchResultImage.dispose(); return super.close(); }

Target:
public boolean close() { if (fetchResultImage != null) { fetchResultImage.dispose(); } return super.close(); }
Source:
@Test public void testTableModify() { String sql = "insert into \"employee\" select * from \"employee\""; RelNode rel = rel(sql); String expectedPhysial = "" + "JdbcToEnumerableConverter\n" + " JdbcTableModify(table=[[foodmart, employee]], operation=[INSERT], flattened=[true])\n" + " JdbcTableScan(table=[[foodmart, employee]])\n"; String expectedLogical = "" + "LogicalTableModify(table=[[foodmart, employee]], " + "operation=[INSERT], flattened=[true])\n" + " LogicalTableScan(table=[[foodmart, employee]])\n"; verify(rel, expectedPhysial, expectedLogical); }

Target:
@Test public void testTableModify() { final String sql = "insert into \"employee\" select * from \"employee\""; final String expectedPhysial = "" + "JdbcToEnumerableConverter\n" + " JdbcTableModify(table=[[foodmart, employee]], operation=[INSERT], flattened=[true])\n" + " JdbcTableScan(table=[[foodmart, employee]])\n"; final String expectedLogical = "" + "LogicalTableModify(table=[[foodmart, employee]], " + "operation=[INSERT], flattened=[true])\n" + " LogicalTableScan(table=[[foodmart, employee]])\n"; verify(rel(sql), expectedPhysial, expectedLogical); }
Source:
public long getVolumeSizeIncludingHypervisorSnapshotReserve(Volume volume, StoragePool pool) { long volumeSize = volume.getSize(); Integer hypervisorSnapshotReserve = volume.getHypervisorSnapshotReserve(); if (hypervisorSnapshotReserve != null) { if (hypervisorSnapshotReserve < 10) { hypervisorSnapshotReserve = 10; } volumeSize += volumeSize * (hypervisorSnapshotReserve / 100f); } return volumeSize; }

Target:
public long getVolumeSizeIncludingHypervisorSnapshotReserve(Volume volume, StoragePool pool) { long volumeSize = volume.getSize(); Integer hypervisorSnapshotReserve = volume.getHypervisorSnapshotReserve(); if (hypervisorSnapshotReserve != null) { hypervisorSnapshotReserve = Math.max(hypervisorSnapshotReserve, s_lowestHypervisorSnapshotReserve); volumeSize += volumeSize * (hypervisorSnapshotReserve / 100f); } return volumeSize; }
Source:
private List<Points.Point> repairRollupsOnRead(final Locator locator, Granularity g, long from, long to) { Timer.Context c = timerRepairRollupsOnRead.time(); List<Points.Point> repairedPoints = new ArrayList<Points.Point>(); List<ListenableFuture<List<Points.Point>>> futures = new ArrayList<ListenableFuture<List<Points.Point>>>(); for( final Iterable<Range> ranges : divideRangesByGroup( g, from, to ) ) { futures.add( createRepairPointsExecutor.submit( new Callable() { @Override public List<Points.Point> call() throws Exception { return createRepairPoints( ranges, locator ); } } ) ); } ListenableFuture<List<List<Points.Point>>> aggregateFuture = Futures.allAsList(futures); try { for( List<Points.Point> subList : aggregateFuture.get(rollupOnReadTimeout.getValue(), rollupOnReadTimeout.getUnit()) ) { repairedPoints.addAll( subList ); } } catch (Exception e) { log.warn(String.format("Exception encountered while doing rollups on read, incomplete rollups will be returned. %s", e.getMessage())); } c.stop(); return repairedPoints; }

Target:
private List<Points.Point> repairRollupsOnRead(final Locator locator, Granularity g, long from, long to) { Timer.Context c = timerRepairRollupsOnRead.time(); List<Points.Point> repairedPoints = new ArrayList<Points.Point>(); List<ListenableFuture<List<Points.Point>>> futures = new ArrayList<ListenableFuture<List<Points.Point>>>(); for( final Iterable<Range> ranges : divideRangesByGroup( g, from, to ) ) { futures.add( createRepairPointsExecutor.submit( new Callable() { @Override public List<Points.Point> call() throws Exception { return createRepairPoints( ranges, locator ); } } ) ); } ListenableFuture<List<List<Points.Point>>> aggregateFuture = Futures.allAsList(futures); try { for( List<Points.Point> subList : aggregateFuture.get(rollupOnReadTimeout.getValue(), rollupOnReadTimeout.getUnit()) ) { repairedPoints.addAll( subList ); } } catch (Exception e) { log.warn("Exception encountered while doing rollups on read, incomplete rollups will be returned.", e); } c.stop(); return repairedPoints; }
Source:
private void tagListModel_SelectedItemsChanged(Object sender, EventArgs e) { boolean hadSelectedTags = getHasSelectedTags(); updateHasSelectedTags(); if (getHasSelectedTags()) { setAllListModelsUnavailable(); getHostList().setIsAvailable(true); getVmList().setIsAvailable(true); getUserList().setIsAvailable(true); } else { updateAvailability(SystemTreeItemType.System, null); getHostList().setSearchString("Host:"); getVmList().setSearchString("Vms:"); getUserList().setSearchString("Users:"); } ListModel oldSelectedItem = getSelectedItem(); if (getHasSelectedTags() && oldSelectedItem != getHostList() && oldSelectedItem != getVolumeList() && oldSelectedItem != getVmList() && oldSelectedItem != getUserList()) { setSelectedItem(getVmList()); } else if (getHasSelectedTags() || hadSelectedTags) { String prefix = ""; String search = ""; RefObject<String> tempRef_prefix = new RefObject<>(prefix); RefObject<String> tempRef_search = new RefObject<>(search); splitSearchString(getSelectedItem().getDefaultSearchString(), tempRef_prefix, tempRef_search); prefix = tempRef_prefix.argvalue; search = tempRef_search.argvalue; setSearchStringPrefix(prefix); setSearchString(search); getSearchCommand().execute(); searchStringChanged(); } }

Target:
private void tagListModel_SelectedItemsChanged(Object sender, EventArgs e) { boolean hadSelectedTags = getHasSelectedTags(); updateHasSelectedTags(); if (getHasSelectedTags()) { setAllListModelsUnavailable(); getHostList().setIsAvailable(true); getVmList().setIsAvailable(true); getUserList().setIsAvailable(true); } else { updateAvailability(SystemTreeItemType.System, null); getHostList().setSearchString(getHostList().getDefaultSearchString()); getVmList().setSearchString(getVmList().getDefaultSearchString()); getUserList().setSearchString(getUserList().getDefaultSearchString()); } ListModel oldSelectedItem = getSelectedItem(); if (getHasSelectedTags() && oldSelectedItem != getHostList() && oldSelectedItem != getVolumeList() && oldSelectedItem != getVmList() && oldSelectedItem != getUserList()) { setSelectedItem(getVmList()); } else if (getHasSelectedTags() || hadSelectedTags) { String prefix = ""; String search = ""; RefObject<String> tempRef_prefix = new RefObject<>(prefix); RefObject<String> tempRef_search = new RefObject<>(search); splitSearchString(getSelectedItem().getDefaultSearchString(), tempRef_prefix, tempRef_search); prefix = tempRef_prefix.argvalue; search = tempRef_search.argvalue; setSearchStringPrefix(prefix); setSearchString(search); getSearchCommand().execute(); searchStringChanged(); } }
Source:
public void index(ObjectStream<Event> eventStream) throws IOException { int cutoff = trainingParameters.getIntParameter(CUTOFF_PARAM, CUTOFF_DEFAULT); boolean sort = trainingParameters.getBooleanParameter(SORT_PARAM, SORT_DEFAULT); long start = System.currentTimeMillis(); display("Indexing events with TwoPass using cutoff of " + cutoff + "\n\n"); display("\tComputing event counts... "); Map<String,Integer> predicateIndex = new HashMap<>(); File tmp = File.createTempFile("events", null); tmp.deleteOnExit(); int numEvents; BigInteger writeHash; HashSumEventStream writeEventStream = new HashSumEventStream(eventStream); try (DataOutputStream dos = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(tmp)))) { numEvents = computeEventCounts(writeEventStream, dos, predicateIndex, cutoff); } writeHash = writeEventStream.calculateHashSum(); display("done. " + numEvents + " events\n"); display("\tIndexing... "); List<ComparableEvent> eventsToCompare; BigInteger readHash = null; try (HashSumEventStream readStream = new HashSumEventStream(new EventStream(tmp))) { eventsToCompare = index(readStream, predicateIndex); readHash = readStream.calculateHashSum(); } tmp.delete(); if (readHash.compareTo(writeHash) != 0) throw new RuntimeException("Event hash for writing and reading events did not match."); display("done.\n"); if (sort) { display("Sorting and merging events... "); } else { display("Collecting events... "); } sortAndMerge(eventsToCompare,sort); display(String.format("Done indexing in %.2f s.\n", (System.currentTimeMillis() - start) / 1000d)); }

Target:
public void index(ObjectStream<Event> eventStream) throws IOException { int cutoff = trainingParameters.getIntParameter(CUTOFF_PARAM, CUTOFF_DEFAULT); boolean sort = trainingParameters.getBooleanParameter(SORT_PARAM, SORT_DEFAULT); long start = System.currentTimeMillis(); display("Indexing events with TwoPass using cutoff of " + cutoff + "\n\n"); display("\tComputing event counts... "); Map<String,Integer> predicateIndex = new HashMap<>(); File tmp = File.createTempFile("events", null); tmp.deleteOnExit(); int numEvents; BigInteger writeHash; HashSumEventStream writeEventStream = new HashSumEventStream(eventStream); try (DataOutputStream dos = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(tmp)))) { numEvents = computeEventCounts(writeEventStream, dos, predicateIndex, cutoff); } writeHash = writeEventStream.calculateHashSum(); display("done. " + numEvents + " events\n"); display("\tIndexing... "); List<ComparableEvent> eventsToCompare; BigInteger readHash = null; try (HashSumEventStream readStream = new HashSumEventStream(new EventStream(tmp))) { eventsToCompare = index(readStream, predicateIndex); readHash = readStream.calculateHashSum(); } tmp.delete(); if (readHash.compareTo(writeHash) != 0) throw new IOException("Event hash for writing and reading events did not match."); display("done.\n"); if (sort) { display("Sorting and merging events... "); } else { display("Collecting events... "); } sortAndMerge(eventsToCompare,sort); display(String.format("Done indexing in %.2f s.\n", (System.currentTimeMillis() - start) / 1000d)); }
Source:
public void constructFromJson() throws Exception { BestAssignments b = APIResource.constructFromJson(json, BestAssignments.class); assertEquals(5.0, (Object) b.getValue()); assertEquals(0.5, (Object) b.getValueStddev()); assertEquals(1.0, b.getAssignments().get("a")); assertEquals("c", b.getAssignments().get("b")); }

Target:
public void constructFromJson() throws Exception { BestAssignments b = APIResource.constructFromJson(json, BestAssignments.class); assertEquals(5.0, (Object) b.getValue()); assertEquals(0.5, (Object) b.getValueStddev()); assertEquals(1, b.getAssignments().getInteger("a")); assertEquals("c", b.getAssignments().get("b")); }
Source:
private void decodeRowType4() throws IOException { if(optionByteAligned) resetBuffer(); eof: while (true) { Node n = eolOnlyTree.root; while (true) { n = n.walk(readBit()); if (n == null) { continue eof; } if (n.isLeaf) { break eof; } } } if (!optionG32D || readBit()) { decode1D(); } else { decode2D(); } }

Target:
private void decodeRowType4() throws IOException { if (optionByteAligned) { resetBuffer(); } eof: while (true) { Node n = eolOnlyTree.root; while (true) { n = n.walk(readBit()); if (n == null) { continue eof; } if (n.isLeaf) { break eof; } } } if (!optionG32D || readBit()) { decode1D(); } else { decode2D(); } }
Source:
public void fetch(GitRepo remoteRepo, IProgressMonitor monitor) throws TransportException { RemoteLocation remoteLoc = remoteRepo.getRemoteLocation(); int work = 10; RecursiveSubMonitor subMon = RecursiveSubMonitor.convert(monitor, work); TransportGitSsh transport = remoteToTransportMap.get(remoteLoc); if (transport == null) { work /= 2; subMon.subTask(Messages.JGitRepo_5); transport = this.buildTransport(remoteLoc, subMon.newChild(work)); remoteToTransportMap.put(remoteLoc, transport); } try { subMon.subTask(Messages.JGitRepo_6); String receiveCommand = remoteRepo.gitBinary() + " receive-pack"; transport.setOptionReceivePack(receiveCommand); transport.fetch(new EclipseGitProgressTransformer(subMon.newChild(work)), null); } catch (NotSupportedException e) { throw new RuntimeException(e); } }

Target:
public void fetch(GitRepo remoteRepo, IProgressMonitor monitor) throws TransportException { RemoteLocation remoteLoc = remoteRepo.getRemoteLocation(); int work = 10; RecursiveSubMonitor subMon = RecursiveSubMonitor.convert(monitor, work); TransportGitSsh transport = remoteToTransportMap.get(remoteLoc); if (transport == null) { work /= 2; subMon.subTask(Messages.JGitRepo_5); transport = this.buildTransport(remoteLoc, subMon.newChild(work)); remoteToTransportMap.put(remoteLoc, transport); } try { subMon.subTask(Messages.JGitRepo_6); String uploadCommand = remoteRepo.gitBinary() + " upload-pack"; transport.setOptionUploadPack(uploadCommand); transport.fetch(new EclipseGitProgressTransformer(subMon.newChild(work)), null); } catch (NotSupportedException e) { throw new RuntimeException(e); } }
Source:
protected List<String> run() throws Exception { final Jenkins jenkins = Jenkins.get(); final Item item = getItemForCredentials(getContext()); final SlackNotifier.DescriptorImpl slackDesc = jenkins .getDescriptorByType(SlackNotifier.DescriptorImpl.class); final String tokenCredentialId = step.tokenCredentialId != null ? step.tokenCredentialId : slackDesc.getTokenCredentialId(); final boolean botUser = step.botUser || slackDesc.isBotUser(); final SlackUserIdResolver userIdResolver = slackDesc.getSlackUserIdResolver(); final Run run = getContext().get(Run.class); final TaskListener listener = getContext().get(TaskListener.class); Objects.requireNonNull(listener, "Listener is mandatory here"); if (!botUser) { listener.getLogger().println("The slackUserIdFromEmail step requires bot user mode"); return null; } final String populatedToken; try { populatedToken = CredentialsObtainer.getTokenToUse(tokenCredentialId, item, null); } catch (final IllegalArgumentException e) { listener.error(Messages.notificationFailedWithException(e)); return null; } final List<String> slackUserIds = new ArrayList<>(); try (CloseableHttpClient client = getHttpClient()) { if (botUser && userIdResolver != null && run != null) { userIdResolver.setAuthToken(populatedToken); userIdResolver.setHttpClient(client); final List<String> userIds = userIdResolver.resolveUserIdsForRun(run); slackUserIds .addAll(userIds.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList())); } } catch (final IOException e) { logger.log(Level.WARNING, "Error closing HttpClient", e); } return slackUserIds; }

Target:
protected List<String> run() throws Exception { final Jenkins jenkins = Jenkins.get(); final Item item = getItemForCredentials(getContext()); final SlackNotifier.DescriptorImpl slackDesc = jenkins .getDescriptorByType(SlackNotifier.DescriptorImpl.class); final String tokenCredentialId = step.tokenCredentialId != null ? step.tokenCredentialId : slackDesc.getTokenCredentialId(); final boolean botUser = step.botUser || slackDesc.isBotUser(); final SlackUserIdResolver userIdResolver = slackDesc.getSlackUserIdResolver(); final Run run = getContext().get(Run.class); final TaskListener listener = getContext().get(TaskListener.class); Objects.requireNonNull(listener, "Listener is mandatory here"); if (!botUser) { listener.getLogger().println("The slackUserIdsFromCommitters step requires bot user mode"); return null; } final String populatedToken; try { populatedToken = CredentialsObtainer.getTokenToUse(tokenCredentialId, item, null); } catch (final IllegalArgumentException e) { listener.error(Messages.notificationFailedWithException(e)); return null; } final List<String> slackUserIds = new ArrayList<>(); try (CloseableHttpClient client = getHttpClient()) { if (userIdResolver != null && run != null) { userIdResolver.setAuthToken(populatedToken); userIdResolver.setHttpClient(client); final List<String> userIds = userIdResolver.resolveUserIdsForRun(run); slackUserIds .addAll(userIds.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList())); } } catch (final IOException e) { logger.log(Level.WARNING, "Error closing HttpClient", e); } return slackUserIds; }
Source:
public void initializeYoutubePlayer() { setVideoModel(); if(youTubePlayer!=null){ removeFragment(); } youTubePlayerFragment = new YouTubePlayerSupportFragment(); try { FragmentManager fm = getChildFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.player_container, youTubePlayerFragment, "player"); ft.commit(); } catch (Exception ex) { logger.error(ex); } initializeHandler.postDelayed(new Runnable() { @Override public void run() { initializeYoutubePlayerFragment(); } }, 1000); }

Target:
public void initializeYoutubePlayer() { try { if (getUserVisibleHint() && youTubePlayerFragment != null && NetworkUtil.verifyDownloadPossible((BaseFragmentActivity) getActivity())) { initTranscripts(); String apiKey = environment.getConfig().getEmbeddedYoutubeConfig().getYoutubeApiKey(); if (apiKey == null || apiKey.isEmpty()) { return; } youTubePlayerFragment.initialize(apiKey, this); } } catch (NullPointerException localException) { logger.error(localException); } }
Source:
public void testSystemPropertyBootTime() throws IOException { DomainClient masterClient = domainMasterLifecycleUtil.getDomainClient(); ModelNode response = masterClient.execute(getReadChildrenNamesOperation(MAIN_RUNNING_SERVER_ADDRESS, SYSTEM_PROPERTY)); ModelNode returnVal = validateResponse(response); int origPropCount = returnVal.asInt(); ModelNode request = getSystemPropertyAddOperation(ROOT_BOOT_PROP_ADDRESS, "domain", Boolean.FALSE); response = masterClient.execute(request); validateResponse(response); response = masterClient.execute(getReadChildrenNamesOperation(MAIN_RUNNING_SERVER_ADDRESS, SYSTEM_PROPERTY)); returnVal = validateResponse(response); Assert.assertEquals(origPropCount + 1, returnVal.asList().size()); response = masterClient.execute(getReadChildrenNamesOperation(OTHER_RUNNING_SERVER_ADDRESS, SYSTEM_PROPERTY)); returnVal = validateResponse(response); Assert.assertEquals(origPropCount + 1, returnVal.asList().size()); response = masterClient.execute(getReadResourceOperation(MAIN_RUNNING_SERVER_BOOT_PROP_ADDRESS)); returnVal = validateResponse(response); validateSystemProperty(returnVal, "domain", false); response = masterClient.execute(getReadResourceOperation(OTHER_RUNNING_SERVER_BOOT_PROP_ADDRESS)); returnVal = validateResponse(response); validateSystemProperty(returnVal, "domain", false); request = getSystemPropertyAddOperation(SERVER_GROUP_BOOT_PROP_ADDRESS, "group", Boolean.FALSE); response = masterClient.execute(request); validateResponse(response); validateSystemProperty(returnVal, "domain", false); response = masterClient.execute(getReadResourceOperation(MAIN_RUNNING_SERVER_BOOT_PROP_ADDRESS)); returnVal = validateResponse(response); validateSystemProperty(returnVal, "domain", false); response = masterClient.execute(getReadResourceOperation(OTHER_RUNNING_SERVER_BOOT_PROP_ADDRESS)); returnVal = validateResponse(response); validateSystemProperty(returnVal, "group", false); }

Target:
public void testSystemPropertyBootTime() throws IOException, MgmtOperationException { DomainClient masterClient = domainMasterLifecycleUtil.getDomainClient(); ModelNode propertyAddress = MAIN_RUNNING_SERVER_CONFIG_ADDRESS.clone().add(SYSTEM_PROPERTY, BOOT_PROPERTY_NAME); validateBootProperty(masterClient, propertyAddress); propertyAddress = new ModelNode().add(SERVER_GROUP, "main-server-group").add(SYSTEM_PROPERTY, BOOT_PROPERTY_NAME); validateBootProperty(masterClient, propertyAddress); propertyAddress = new ModelNode().add(HOST, "master").add(SYSTEM_PROPERTY, BOOT_PROPERTY_NAME); validateBootProperty(masterClient, propertyAddress); propertyAddress = new ModelNode().add(SYSTEM_PROPERTY, BOOT_PROPERTY_NAME); validateBootProperty(masterClient, propertyAddress); }
Source:
public ResponseEntity<Resources<Resource<Release>>> getECCsOfReleases(@PathVariable("id") String id, OAuth2Authentication oAuth2Authentication) { final User sw360User = this.restControllerHelper.getSw360UserFromAuthentication(oAuth2Authentication); final Project project = this.projectService.getProjectForUserById(id, sw360User); final List<Resource<Release>> releaseResources = new ArrayList<>(); final Map<String, ProjectReleaseRelationship> releaseIdToUsage = project.getReleaseIdToUsage(); for (final String releaseId : releaseIdToUsage.keySet()) { final Release release = this.releaseService.getReleaseForUserById(releaseId, sw360User); final Release minRelease = new Release(); minRelease.setId(release.getId()); minRelease.setEccInformation(release.getEccInformation()); final Resource<Release> releaseResource = new Resource<>(minRelease); releaseResources.add(releaseResource); } final Resources<Resource<Release>> resources = new Resources<>(releaseResources); return new ResponseEntity<>(resources, HttpStatus.OK); }

Target:
public ResponseEntity<Resources<Resource<Release>>> getECCsOfReleases(@PathVariable("id") String id, OAuth2Authentication oAuth2Authentication) { final User sw360User = restControllerHelper.getSw360UserFromAuthentication(oAuth2Authentication); final Project project = projectService.getProjectForUserById(id, sw360User); final List<Resource<Release>> releaseResources = new ArrayList<>(); final Map<String, ProjectReleaseRelationship> releaseIdToUsage = project.getReleaseIdToUsage(); for (final String releaseId : releaseIdToUsage.keySet()) { final Release sw360Release = releaseService.getReleaseForUserById(releaseId, sw360User); final Release minimalFilledRelease = new Release(); minimalFilledRelease.setId(sw360Release.getId()); minimalFilledRelease.setEccInformation(sw360Release.getEccInformation()); final Resource<Release> releaseResource = new Resource<>(minimalFilledRelease); releaseResources.add(releaseResource); } final Resources<Resource<Release>> resources = new Resources<>(releaseResources); return new ResponseEntity<>(resources, HttpStatus.OK); }
Source:
public void purgeExpired() { if (!enabled) return; long start = -1; try { if (trace) { log.trace("Purging cache store of expired entries"); start = timeService.time(); } storesMutex.readLock().lock(); try { Consumer<CacheWriter> purgeWriter = writer -> { if (writer instanceof AdvancedCacheExpirationWriter) { ((AdvancedCacheExpirationWriter)writer).purge(persistenceExecutor, advanedListener); } else if (writer instanceof AdvancedCacheWriter) { ((AdvancedCacheWriter)writer).purge(persistenceExecutor, key -> { expirationManager.handleInStoreExpiration(key); }); } }; nonTxWriters.forEach(purgeWriter); txWriters.forEach(purgeWriter); } finally { storesMutex.readLock().unlock(); } if (trace) { log.tracef("Purging cache store completed in %s", Util.prettyPrintTime(timeService.timeDuration(start, TimeUnit.MILLISECONDS))); } } catch (Exception e) { log.exceptionPurgingDataContainer(e); } }

Target:
public void purgeExpired() { if (!enabled) return; long start = -1; try { if (trace) { log.trace("Purging cache store of expired entries"); start = timeService.time(); } storesMutex.readLock().lock(); try { Consumer<CacheWriter> purgeWriter = writer -> { if (writer instanceof AdvancedCacheExpirationWriter) { ((AdvancedCacheExpirationWriter)writer).purge(persistenceExecutor, advancedListener); } else if (writer instanceof AdvancedCacheWriter) { ((AdvancedCacheWriter)writer).purge(persistenceExecutor, key -> { expirationManager.handleInStoreExpiration(key); }); } }; nonTxWriters.forEach(purgeWriter); txWriters.forEach(purgeWriter); } finally { storesMutex.readLock().unlock(); } if (trace) { log.tracef("Purging cache store completed in %s", Util.prettyPrintTime(timeService.timeDuration(start, TimeUnit.MILLISECONDS))); } } catch (Exception e) { log.exceptionPurgingDataContainer(e); } }
Source:
public BigDecimal getCryptoBalance(String cryptoCurrency) { if (!getCryptoCurrencies().contains(cryptoCurrency)) { log.error("Cryptocurrency " + cryptoCurrency + " not supported."); return null; } try { String query = ""; String timeStamp = String.valueOf(new Date().getTime()); query = "recvWindow=" + 5000 + "&timestamp=" + timeStamp; String signing = sign(query, binanceApiSecret); final Map<String, Object> accountInfo = apiBinance.getCryptoBalance(this.binanceApiKey, String.valueOf(5000), timeStamp, signing); if (accountInfo != null && !accountInfo.isEmpty()) { final List<Object> balances = (List<Object>) accountInfo.get("balances"); if(balances != null && !balances.isEmpty()) { for (Object dataObject : balances) { final Map<String, Object> map = (Map<String, Object>) dataObject; final String asset = (String) map.get("asset"); BigDecimal value = new BigDecimal((String) map.get("free")); if (asset.equals(cryptoCurrency)) { return value; } } } } } catch (HttpStatusIOException e) { log.error(e.getHttpBody()); } catch (IOException e) { log.error("", e); } return null; }

Target:
public BigDecimal getCryptoBalance(String cryptoCurrency) { if (!getCryptoCurrencies().contains(cryptoCurrency)) { log.error("Cryptocurrency " + cryptoCurrency + " not supported."); return null; } try { String query = ""; String timeStamp = String.valueOf(new Date().getTime()); query = "recvWindow=" + 5000 + "&timestamp=" + timeStamp; String signing = sign(query, binanceApiSecret); final LskBinanceResponse accountInfo = apiBinance.getCryptoBalance(this.binanceApiKey, String.valueOf(5000), timeStamp, signing); if (accountInfo != null) { List<LskBinanceAssetData> balances = (List<LskBinanceAssetData>) accountInfo.getBalance(); if(balances != null && !balances.isEmpty()) { for (LskBinanceAssetData assetData : balances) { final String asset = (String) assetData.getAsset(); BigDecimal value = assetData.getFree(); if (asset.equals(cryptoCurrency)) { return value; } } } } } catch (HttpStatusIOException e) { log.error(e.getHttpBody()); } catch (IOException e) { log.error("", e); } return null; }
Source:
public void JKaliTest() throws Exception { FinalResult result = TestUtills.runRepairability("JKaliTest", "/repairability_test_files/JKali/"); TestUtills.numberOfInstances(result, 5, 5); }

Target:
public void JKaliTest() throws Exception { FinalResult result = TestUtills.runRepairability("JKali", "/repairability_test_files/JKali/"); TestUtills.numberOfInstances(result, 5, 5); }
Source:
protected boolean connect () { try { if (sysLibrary == null ) { logger.debug("Loading native code library..."); sysLibrary = (LibK8055) Native.synchronizedLibrary((Library) Native.loadLibrary("k8055", LibK8055.class)); logger.debug("Done loading native code library"); } } catch (Exception e) { logger.error("Failed to load K8055 native library " + e.getMessage(), e); } if (!connected) { if (sysLibrary.OpenDevice(boardNo) == boardNo) { connected = true; lastDigitalInputs = -1; try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } logger.info("K8055: Connect to board: " + boardNo + " succeeeded."); } else { logger.error("K8055: Connect to board: " + boardNo + " failed."); } }; return connected; }

Target:
protected boolean connect() { try { if (sysLibrary == null) { logger.debug("Loading native code library..."); sysLibrary = (LibK8055) Native .synchronizedLibrary((Library) Native.loadLibrary( "k8055", LibK8055.class)); logger.debug("Done loading native code library"); } if (!connected) { if (sysLibrary.OpenDevice(boardNo) == boardNo) { connected = true; lastDigitalInputs = -1; logger.info("K8055: Connect to board: " + boardNo + " succeeeded."); } else { logger.error("K8055: Connect to board: " + boardNo + " failed."); } } ; } catch (Exception e) { logger.error( "Failed to load K8055 native library. Please check the libk8055 and jna native libraries are in the Java library path. ", e); } return connected; }