auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean canConnectToExternal(EnumFacing dir, boolean ignoreDisabled) { World world = getBundle().getBundleWorldObj(); BlockCoord pos = getLocation(); TileEntity te = world.getTileEntity(pos.getLocation(dir).getBlockPos()); if(te instanceof TileConduitBundle) { return false; } if(te instanceof IPartHost) { IPart part = ((IPartHost) te).getPart(dir.getOpposite()); if(part == null) { part = ((IPartHost) te).getPart(AEPartLocation.INTERNAL); return part != null; } if(part.getExternalFacingNode() != null) { return true; } String name = part.getClass().getSimpleName(); return "PartP2PTunnelME".equals(name) || "PartQuartzFiber".endsWith(name) || "PartToggleBus".equals(name) || "PartInvertedToggleBus".equals(name); } else if(te instanceof IGridHost) { IGridNode node = ((IGridHost) te).getGridNode(AEPartLocation.fromFacing(dir.getOpposite())); if(node == null) { node = ((IGridHost) te).getGridNode(AEPartLocation.INTERNAL); } if(node != null) { return node.getGridBlock().getConnectableSides().contains(dir.getOpposite()); } } return false; }

Target:
public boolean canConnectToExternal(EnumFacing dir, boolean ignoreDisabled) { World world = getBundle().getBundleWorldObj(); BlockCoord pos = getLocation(); TileEntity te = BlockEnder.getAnyTileEntitySafe(world, pos.getLocation(dir).getBlockPos()); if(te instanceof TileConduitBundle) { return false; } if(te instanceof IPartHost) { IPart part = ((IPartHost) te).getPart(dir.getOpposite()); if(part == null) { part = ((IPartHost) te).getPart(AEPartLocation.INTERNAL); return part != null; } if(part.getExternalFacingNode() != null) { return true; } String name = part.getClass().getSimpleName(); return "PartP2PTunnelME".equals(name) || "PartQuartzFiber".equals(name) || "PartToggleBus".equals(name) || "PartInvertedToggleBus".equals(name); } else if(te instanceof IGridHost) { IGridNode node = ((IGridHost) te).getGridNode(AEPartLocation.fromFacing(dir.getOpposite())); if(node == null) { node = ((IGridHost) te).getGridNode(AEPartLocation.INTERNAL); } if(node != null) { return node.getGridBlock().getConnectableSides().contains(dir.getOpposite()); } } return false; }
Source:
public void handleNiNotification(GpsNiNotification notif) { if (DEBUG) Log.d(TAG, "in handleNiNotification () :" + " notificationId: " + notif.notificationId + " requestorId: " + notif.requestorId + " text: " + notif.text); if (mNetInitiatedListener != null) { if (mIsSuplEsEnabled == 0) { if (DEBUG) Log.d(TAG, "SUPL_ES is disabled, calling handleNi(notif)"); handleNi(notif); } else { if (DEBUG) Log.d(TAG, "SUPL_ES is enabled, calling handleNiInEs(notif)"); handleNiInEs(notif); } } else { Log.e(TAG, "mNetInitiatedListener is null"); } }

Target:
public void handleNiNotification(GpsNiNotification notif) { if (DEBUG) Log.d(TAG, "in handleNiNotification () :" + " notificationId: " + notif.notificationId + " requestorId: " + notif.requestorId + " text: " + notif.text + " mIsSuplEsEnabled" + mIsSuplEsEnabled); if (mIsSuplEsEnabled == true) { handleNi(notif); } else { handleNiInEs(notif); } }
Source:
public boolean isAuthenticated(){ return true; }

Target:
public boolean isAuthenticated(){ return authenticated; }
Source:
public McMMOPlayerBrewEvent(Player player, Block brewingStand) { super(player, SkillType.ALCHEMY); this.setBrewingStandBlock(brewingStand); cancelled = false; }

Target:
public McMMOPlayerBrewEvent(Player player, Block brewingStand) { super(player, SkillType.ALCHEMY); this.brewingStand = brewingStand; cancelled = false; }
Source:
public void capitalizeTurkish() { Locale.setDefault(TURKEY_LOCALE); String international = Strings.capitalize("international"); assertEquals("International", international); }

Target:
public void capitalizeTurkish() { Locale.setDefault( TURKEY_LOCALE ); String international = Strings.capitalize( "international" ); assertThat( international ).isEqualTo( "International" ); }
Source:
private void preLoadSVG() { final SVGFigure svgFigure = new SVGFigure(); try { final File iconsFolder = new File(FileLocator.toFileURL(Platform.getBundle("org.bonitasoft.studio.pics").getResource("icons")).getFile()); for (final String filename : new File(iconsFolder, "figures").list()) { if (filename.endsWith(".svgz")) { svgFigure.setURI("platform:/plugin/org.bonitasoft.studio.pics/icons/figures/" + filename); } } for (final String filename : new File(iconsFolder, "decoration" + File.separatorChar + "svg").list()) { if (filename.endsWith(".svgz")) { svgFigure.setURI("platform:/plugin/org.bonitasoft.studio.pics/icons/decoration/svg/" + filename); } } } catch (final IOException e) { BonitaStudioLog.error(e); } }

Target:
private void preLoadSVG() { final SVGFigure svgFigure = new SVGFigure(); try { final File iconsFolder = new File(FileLocator.toFileURL(Platform.getBundle("org.bonitasoft.studio.pics").getResource("icons")).getFile()); initSVGFigure(svgFigure, iconsFolder, "figures"); initSVGFigure(svgFigure, iconsFolder, "decoration", "svg"); } catch (final IOException e) { BonitaStudioLog.error(e); } }
Source:
private Response getSearchResponse(Account account, Map<String, String> queryParams) { String url = connectorUriGenerator.refundsURIWithParams(account, queryParams); Response connectorResponse = client .target(url) .request() .header(HttpHeaders.ACCEPT, APPLICATION_JSON) .get(); LOGGER.info("response from connector for refunds search: {}", connectorResponse); if (connectorResponse.getStatus() == SC_OK) { return processResponse(connectorResponse); } throw new SearchRefundsException(connectorResponse); }

Target:
private Response getSearchResponse(Account account, Map<String, String> queryParams) { String url = connectorUriGenerator.refundsURIWithParams(account, queryParams); Response connectorResponse = client .target(url) .request() .header(HttpHeaders.ACCEPT, APPLICATION_JSON) .get(); if (connectorResponse.getStatus() == SC_OK) { return processResponse(connectorResponse); } throw new SearchRefundsException(connectorResponse); }
Source:
protected static int parseFraction(String string, int sign, String text) { if (string == null || string.length() == 0) { return 0; } try { string = (string + "000000000").substring(0, 9); return Integer.parseInt(string) * sign; } catch (NumberFormatException | ArithmeticException e) { throw (DateTimeParseException) new DateTimeParseException( "Text cannot be parsed to a PeriodAndDuration: fraction", text, 0).initCause(e); } }

Target:
protected static int parseFraction(String string, int sign, String text) { if (string == null || string.length() == 0) { return 0; } try { string = (string + "000000000").substring(0, 9); return Integer.parseInt(string) * sign; } catch (NumberFormatException | ArithmeticException e) { throw new DateTimeParseException("Text cannot be parsed to a PeriodAndDuration: fraction", text, 0, e); } }
Source:
public Expression find(ActivityDefinition activityDefinition, long expressionDefinitionId) { final Expression displayName = activityDefinition.getDisplayName(); if (getExpressionWithId(displayName, expressionDefinitionId) != null) { return displayName; } final LoopCharacteristics loopCharacteristics = activityDefinition.getLoopCharacteristics(); final Expression expression = getExpressionFromContainer(loopCharacteristics, expressionDefinitionId); if (expression != null) { return expression; } for (BusinessDataDefinition businessDataDefinition : activityDefinition.getBusinessDataDefinitions()) { final Expression bizDataExpression = getExpressionFromContainer(businessDataDefinition, expressionDefinitionId); if (bizDataExpression != null) { return bizDataExpression; } } for (DataDefinition dataDefinition : activityDefinition.getDataDefinitions()) { final Expression dataExpression = getExpressionFromContainer(dataDefinition, expressionDefinitionId); if (dataExpression != null) { return dataExpression; } } final Expression expressionFromOperation = getExpressionFromOperationList(activityDefinition.getOperations(), expressionDefinitionId); if (expressionFromOperation != null) { return expressionFromOperation; } for (BoundaryEventDefinition boundaryEventDefinition : activityDefinition.getBoundaryEventDefinitions()) { final Expression expressionFromBoundary = getExpressionFromContainer(boundaryEventDefinition, expressionDefinitionId); if (expressionFromBoundary == null) { return expressionFromBoundary; } } return null; }

Target:
public Expression find(ActivityDefinition activityDefinition, long expressionDefinitionId) { final Expression displayName = activityDefinition.getDisplayName(); if (getExpressionFromContainer(displayName, expressionDefinitionId) != null) { return displayName; } final LoopCharacteristics loopCharacteristics = activityDefinition.getLoopCharacteristics(); final Expression expression = getExpressionFromContainer(loopCharacteristics, expressionDefinitionId); if (expression != null) { return expression; } for (BusinessDataDefinition businessDataDefinition : activityDefinition.getBusinessDataDefinitions()) { final Expression bizDataExpression = getExpressionFromContainer(businessDataDefinition, expressionDefinitionId); if (bizDataExpression != null) { return bizDataExpression; } } for (DataDefinition dataDefinition : activityDefinition.getDataDefinitions()) { final Expression dataExpression = getExpressionFromContainer(dataDefinition, expressionDefinitionId); if (dataExpression != null) { return dataExpression; } } final Expression expressionFromOperation = getExpressionFromOperationList(activityDefinition.getOperations(), expressionDefinitionId); if (expressionFromOperation != null) { return expressionFromOperation; } for (BoundaryEventDefinition boundaryEventDefinition : activityDefinition.getBoundaryEventDefinitions()) { final Expression expressionFromBoundary = getExpressionFromContainer(boundaryEventDefinition, expressionDefinitionId); if (expressionFromBoundary != null) { return expressionFromBoundary; } } return null; }
Source:
public Collection<Replay> getLocalReplays() { Collection<Replay> replayInfos = new ArrayList<>(); String replayFileGlob = clientProperties.getReplay().getReplayFileGlob(); Path replaysDirectory = preferencesService.getReplaysDirectory(); if (Files.notExists(replaysDirectory)) { noCatch(() -> createDirectories(replaysDirectory)); } try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(replaysDirectory, replayFileGlob)) { StreamSupport.stream(directoryStream.spliterator(), false) .sorted(Comparator.comparing(path -> ((Path) path).toFile().lastModified()).reversed()) .limit(MAX_REPLAYS) .forEach(replayFile -> { try { LocalReplayInfo replayInfo = replayFileReader.parseMetaData(replayFile); FeaturedMod featuredMod = modService.getFeaturedMod(replayInfo.getFeaturedMod()).get(); mapService.findByMapFolderName(replayInfo.getMapname()) .thenAccept(mapBean -> replayInfos.add(new Replay(replayInfo, replayFile, featuredMod, mapBean.orElse(null)))); } catch (Exception e) { logger.warn("Could not read replay file '{}'", replayFile, e); moveCorruptedReplayFile(replayFile); } }); } return replayInfos; }

Target:
public Collection<Replay> getLocalReplays() { Collection<Replay> replayInfos = new ArrayList<>(); String replayFileGlob = clientProperties.getReplay().getReplayFileGlob(); Path replaysDirectory = preferencesService.getReplaysDirectory(); if (Files.notExists(replaysDirectory)) { noCatch(() -> createDirectories(replaysDirectory)); } try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(replaysDirectory, replayFileGlob)) { StreamSupport.stream(directoryStream.spliterator(), false) .sorted(Comparator.comparing(path -> noCatch(() -> Files.getLastModifiedTime((Path) path))).reversed()) .limit(MAX_REPLAYS) .forEach(replayFile -> { try { LocalReplayInfo replayInfo = replayFileReader.parseMetaData(replayFile); FeaturedMod featuredMod = modService.getFeaturedMod(replayInfo.getFeaturedMod()).get(); mapService.findByMapFolderName(replayInfo.getMapname()) .thenAccept(mapBean -> replayInfos.add(new Replay(replayInfo, replayFile, featuredMod, mapBean.orElse(null)))); } catch (Exception e) { logger.warn("Could not read replay file '{}'", replayFile, e); moveCorruptedReplayFile(replayFile); } }); } return replayInfos; }
Source:
@VisibleForTesting BookingError asBookingError(String bookingErrorJson) { final JsonReader jsonReader = new JsonReader(new StringReader(bookingErrorJson)); jsonReader.setLenient(true); return gson.fromJson(jsonReader, BookingError.class); }

Target:
@VisibleForTesting BookingError asBookingError(String bookingErrorJson) { return gson.fromJson(bookingErrorJson, BookingError.class); }
Source:
public void onUserOnline(UserOnlineEvent event) { String username = event.getUsername(); Player player = playerService.getPlayerForUsername(username); if (player != null && player.getSocialStatus() == SocialStatus.FRIEND) { audioService.playFriendOnlineSound(); notificationService.addNotification( new TransientNotification( i18n.get("friend.nowOnlineNotification.title", username), i18n.get("friend.nowOnlineNotification.action"), IdenticonUtil.createIdenticon(player.getId()), event1 -> { eventBus.post(new NavigateEvent(NavigationItem.CHAT)); eventBus.post(new InitiatePrivateChatEvent(username)); } )); } }

Target:
public void onUserOnline(UserOnlineEvent event) { String username = event.getUsername(); Player player = playerService.getPlayerForUsername(username); if (player != null && player.getSocialStatus() == SocialStatus.FRIEND) { audioService.playFriendOnlineSound(); notificationService.addNotification( new TransientNotification( i18n.get("friend.nowOnlineNotification.title", username), i18n.get("friend.nowOnlineNotification.action"), IdenticonUtil.createIdenticon(player.getId()), actionEvent -> { eventBus.post(new NavigateEvent(NavigationItem.CHAT)); eventBus.post(new InitiatePrivateChatEvent(username)); } )); } }
Source:
public void onWireReceive(WireEnvelope wireEnvelope) { requireNonNull(wireEnvelope, message.wireEnvelopeNonNull()); if (emitterThread != null) { emitterThread.sumit(wireEnvelope); } }

Target:
public void onWireReceive(WireEnvelope wireEnvelope) { requireNonNull(wireEnvelope, message.wireEnvelopeNonNull()); if (emitterThread != null) { emitterThread.submit(wireEnvelope); } }
Source:
public void executeCommand(UICommand command) { super.executeCommand(command); if ("OnSave".equals(command.getName())) { onSave(); } if (command == getVnicProfileMappingCommand() && getWindow() == null) { updateExternalVnicProfilesPerTargetCluster(); vnicProfileMappingModel = new VnicProfileMappingModel(this, externalVnicProfilesPerTargetCluster); vnicProfileMappingModel.initialize(); setWindow(vnicProfileMappingModel); } }

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if ("OnSave".equals(command.getName())) { onSave(); } if (VNIC_PROFILE_MAPPING_COMMAND.equals(command.getName())) { onVnicProfileMappingCommand(); } }
Source:
public void processBeforeCommit(IntegrationResourceHolder holder) { if (this.beforeCommitChannel != null) { doProcess(holder, this.beforeCommitExpression, this.beforeCommitChannel, "beforeCommit"); } }

Target:
public void processBeforeCommit(IntegrationResourceHolder holder) { doProcess(holder, this.beforeCommitExpression, this.beforeCommitChannel, "beforeCommit"); }
Source:
public double getMeanJobPendingTime() { return executeReadOnlyTransaction(session -> { Query query = session.getNamedQuery("getMeanJobPendingTime"); Double result = (Double) query.uniqueResult(); return result == null ? 0 : result; }); }

Target:
public double getMeanJobPendingTime() { return executeReadOnlyTransaction(session -> { Query query = session.getNamedQuery("getMeanJobPendingTime"); Double result = (Double) query.uniqueResult(); return result == null ? 0.0d : result; }); }
Source:
public EventBus build() { final String message = "Either storageFactory or eventStore must be " + "set to build the EventBus instance"; checkState(storageFactory != null || eventStore != null, message); if (eventStoreStreamExecutor == null) { this.eventStoreStreamExecutor = MoreExecutors.directExecutor(); } if (eventStore == null) { eventStore = EventStore.newBuilder() .setStreamExecutor(eventStoreStreamExecutor) .setStorageFactory(storageFactory) .setLogger(EventStore.log()) .build(); } if (dispatcherEventDelivery == null) { dispatcherEventDelivery = DispatcherEventDelivery.directDelivery(); } if (eventValidator == null) { eventValidator = MessageValidator.newInstance(); } final EventBus result = new EventBus(this); return result; }

Target:
public EventBus build() { final String message = "Either storageFactory or eventStore must be " + "set to build the EventBus instance"; checkState(storageFactory != null || eventStore != null, message); if (eventStoreStreamExecutor == null) { eventStoreStreamExecutor = MoreExecutors.directExecutor(); } assert (eventStoreStreamExecutor != null); if (eventStore == null) { eventStore = EventStore.newBuilder() .setStreamExecutor(eventStoreStreamExecutor) .setStorageFactory(storageFactory) .setLogger(EventStore.log()) .build(); } if (dispatcherEventDelivery == null) { dispatcherEventDelivery = DispatcherEventDelivery.directDelivery(); } if (eventValidator == null) { eventValidator = MessageValidator.newInstance(); } final EventBus result = new EventBus(this); return result; }
Source:
SequentialIntegerDataGenerator(Column columnRule) { Preconditions.checkArgument(columnRule.getDataSequence() == DataSequence.SEQUENTIAL); Preconditions.checkArgument(isIntegerType(columnRule.getType())); this.columnRule = columnRule; minValue = columnRule.getMinValue(); maxValue = columnRule.getMaxValue(); counter = new AtomicLong(minValue); }

Target:
public SequentialIntegerDataGenerator(Column columnRule) { Preconditions.checkArgument(columnRule.getDataSequence() == DataSequence.SEQUENTIAL); Preconditions.checkArgument(isIntegerType(columnRule.getType())); this.columnRule = columnRule; minValue = columnRule.getMinValue(); maxValue = columnRule.getMaxValue(); counter = new AtomicLong(0); }
Source:
private void setMessageProperties(Message msg, Map<String, String> properties) throws ProducerException { if (msg != null && properties != null) { final Map<String, String> props = new HashMap<>(); if (properties != null) props.putAll(properties); if (this.properties != null) props.putAll(this.properties); props.entrySet().stream().filter(entry -> entry.getValue() != null) .forEach(property -> { try { if(msg.getObjectProperty(property.getKey()) == null) { msg.setObjectProperty(property.getKey(), property.getValue()); } } catch (Exception e) { } }); } }

Target:
private void setMessageProperties(Message msg, Map<String, String> properties) throws ProducerException { if (msg != null && properties != null) { final Map<String, String> props = new HashMap<>(); if (this.properties != null) props.putAll(this.properties); if (properties != null) props.putAll(properties); props.entrySet().stream().filter(entry -> entry.getValue() != null) .forEach(property -> { try { if (msg.getObjectProperty(property.getKey()) == null) { msg.setObjectProperty(property.getKey(), property.getValue()); } } catch (Exception e) { } }); } }
Source:
public SubmitQueryResponse executeQuery(Session session, String query, boolean isJson) { LOG.info("Query: " + query); QueryContext queryContext = createQueryContext(session); QueryContextUtil.updatePythonScriptPath(context.getConf(), queryContext); Expr planningContext; try { if (isJson) { planningContext = buildExpressionFromJson(query); } else { planningContext = buildExpressionFromSql(query, session); } String jsonExpr = planningContext.toJson(); LogicalPlan plan = createLogicalPlan(queryContext, planningContext); SubmitQueryResponse response = queryExecutor.execute(queryContext, session, query, jsonExpr, plan); return response; } catch (Throwable t) { context.getSystemMetrics().counter("Query", "errorQuery").inc(); LOG.error("\nStack Trace:\n" + StringUtils.stringifyException(t)); SubmitQueryResponse.Builder responseBuilder = SubmitQueryResponse.newBuilder(); responseBuilder.setUserName(queryContext.get(SessionVars.USERNAME)); responseBuilder.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto()); responseBuilder.setIsForwarded(true); responseBuilder.setResultCode(ClientProtos.ResultCode.ERROR); String errorMessage = t.getMessage(); if (t.getMessage() == null) { errorMessage = t.getClass().getName(); } responseBuilder.setErrorMessage(errorMessage); responseBuilder.setErrorTrace(StringUtils.stringifyException(t)); return responseBuilder.build(); } }

Target:
public SubmitQueryResponse executeQuery(Session session, String query, boolean isJson) { LOG.info("Query: " + query); QueryContext queryContext = createQueryContext(session); Expr planningContext; try { if (isJson) { planningContext = buildExpressionFromJson(query); } else { planningContext = buildExpressionFromSql(query, session); } String jsonExpr = planningContext.toJson(); LogicalPlan plan = createLogicalPlan(queryContext, planningContext); SubmitQueryResponse response = queryExecutor.execute(queryContext, session, query, jsonExpr, plan); return response; } catch (Throwable t) { context.getSystemMetrics().counter("Query", "errorQuery").inc(); LOG.error("\nStack Trace:\n" + StringUtils.stringifyException(t)); SubmitQueryResponse.Builder responseBuilder = SubmitQueryResponse.newBuilder(); responseBuilder.setUserName(queryContext.get(SessionVars.USERNAME)); responseBuilder.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto()); responseBuilder.setIsForwarded(true); responseBuilder.setResultCode(ClientProtos.ResultCode.ERROR); String errorMessage = t.getMessage(); if (t.getMessage() == null) { errorMessage = t.getClass().getName(); } responseBuilder.setErrorMessage(errorMessage); responseBuilder.setErrorTrace(StringUtils.stringifyException(t)); return responseBuilder.build(); } }
Source:
public static void init() throws IOException { SWTBotUtils.failIfUIThread(); Thread.currentThread().setName("SWTBot Thread"); SWTBotPreferences.TIMEOUT = 20000; fLogger.addAppender(new ConsoleAppender(new SimpleLayout())); fBot = new SWTWorkbenchBot(); SWTBotUtils.closeView("welcome", fBot); SWTBotUtils.switchToTracingPerspective(); SWTBotUtils.waitForJobs(); fFileLocation = File.createTempFile("sample", ".xml"); String eventNames[] = { "test:SEND", "test:RECEIVE" }; String targets[] = { "cloud", "aerith" }; try (BufferedRandomAccessFile braf = new BufferedRandomAccessFile(fFileLocation, "rw")) { braf.writeBytes(TRACE_START); for (int i = 0; i < 100; i++) { braf.writeBytes(makeEvent(i * i * 100, eventNames[i % 2], targets[i % 2], targets[(i + 1) % 2], Integer.toString(i % 2 + 1000))); } braf.writeBytes(TRACE_END); } }

Target:
public static void init() throws IOException { SWTBotUtils.failIfUIThread(); Thread.currentThread().setName("SWTBot Thread"); SWTBotPreferences.TIMEOUT = 20000; fLogger.addAppender(new ConsoleAppender(new SimpleLayout())); fBot = new SWTWorkbenchBot(); SWTBotUtils.closeView("welcome", fBot); SWTBotUtils.switchToTracingPerspective(); SWTBotUtils.waitForJobs(); fFileLocation = File.createTempFile("sample", ".xml"); String eventNames[] = { "test:SEND", "test:RECEIVE" }; String targets[] = { "peer1", "peer2" }; try (BufferedRandomAccessFile braf = new BufferedRandomAccessFile(fFileLocation, "rw")) { braf.writeBytes(TRACE_START); for (int i = 0; i < 100; i++) { braf.writeBytes(makeEvent(i * i * 100, eventNames[i % 2], targets[i % 2], targets[(i + 1) % 2], Integer.toString(i % 2 + 1000))); } braf.writeBytes(TRACE_END); } }
Source:
public void setSpatialOps(SpatialOperatorsType spatialOperators) { spatialOps = new ConcurrentHashMap<SPATIAL_OPERATORS, SpatialOperatorType>( new EnumMap<SPATIAL_OPERATORS, SpatialOperatorType>(SPATIAL_OPERATORS.class)); for (SpatialOperatorType spatialOp : spatialOperators.getSpatialOperator()) { LOGGER.debug("Adding key [spatialOp Name: {}]", spatialOp.getName()); spatialOps.put(SPATIAL_OPERATORS.valueOf(spatialOp.getName()), spatialOp); if (LOGGER.isDebugEnabled()) { LOGGER.debug("spatialOps Map: {}", spatialOps.toString()); } } }

Target:
public void setSpatialOps(SpatialOperatorsType spatialOperators) { spatialOps = new ConcurrentHashMap<SPATIAL_OPERATORS, SpatialOperatorType>( new EnumMap<SPATIAL_OPERATORS, SpatialOperatorType>(SPATIAL_OPERATORS.class)); for (SpatialOperatorType spatialOp : spatialOperators.getSpatialOperator()) { LOGGER.debug("Adding key [spatialOp Name: {}]", spatialOp.getName()); spatialOps.put(SPATIAL_OPERATORS.valueOf(spatialOp.getName()), spatialOp); LOGGER.debug("spatialOps Map: {}", spatialOps); } }
Source:
public void changeAccount(Account account) { userManager.setSessionCookie(null); userManager.setSessionToken(null); displayFab.set(!userManager.isGuest(account)); if (account == null) return; if (userManager.getUsername(account).equals(username.get())) return; userManager.moreBusy("main login"); username.set(userManager.getUsername(account)); url.set(userManager.getSiteUrl(account)); Log.d("MainViewModel", "login " + username.get() + " on " + url.get()); LoginSubscriber loginSubscriber = new LoginSubscriber(); if (userManager.isGuest(account)) { loginSubscriber.onNext(new SuccessResponse()); } else { mUserRepository.login(account).subscribe(loginSubscriber); } }

Target:
public void changeAccount(Account account) { userManager.setSessionCookie(null); userManager.setSessionToken(null); displayFab.set(!userManager.isGuest(account)); if (account == null) return; EspressoIdlingResource.moreBusy("main login"); username.set(userManager.getUsername(account)); url.set(userManager.getSiteUrl(account)); Log.d("MainViewModel", "login " + username.get() + " on " + url.get()); LoginSubscriber loginSubscriber = new LoginSubscriber(); if (userManager.isGuest(account)) { loginSubscriber.onNext(new SuccessResponse()); } else { mUserRepository.login(account).subscribe(loginSubscriber); } }
Source:
public void setName(String name) { if (Strings.isNotNullAndNotEmpty(name)) { m_name = name; } }

Target:
public void setName(String name) { if (Strings.isNullOrEmpty(name)) { throw new IllegalArgumentException("Suite name cannot be null (or) empty."); } m_name = name; }
Source:
protected void hookOnNext(T value) { if (durationTimer.isStarted()) { durationTimer.stop(); } if (durationTimer != null && durationTimer.getTime() > thresholdForDiagnosticsInMs) { if (value instanceof CosmosItemResponse) { CosmosItemResponse itemResponse = (CosmosItemResponse) value; logger.info("Request taking longer than {}ms diagnostic = {}", thresholdForDiagnosticsInMs, itemResponse.getDiagnostics().toString()); } else if (value instanceof FeedResponse) { durationTimer.reset(); durationTimer.start(); FeedResponse feedResponse = (FeedResponse) value; logger.info("Request taking longer than {}ms diagnostic = {}", thresholdForDiagnosticsInMs, feedResponse.getCosmosDiagnostics().toString()); } } logger.debug("hookOnNext: {}, count:{}", value, count.get()); }

Target:
protected void hookOnNext(T value) { if ((System.currentTimeMillis() - startTimeInMs) > diagnosticsThresholdDuration.toMillis()) { if (value instanceof CosmosItemResponse) { CosmosItemResponse itemResponse = (CosmosItemResponse) value; logger.info("Request taking longer than {}ms diagnostic = {}", diagnosticsThresholdDuration.toMillis(), itemResponse.getDiagnostics().toString()); } else if (value instanceof FeedResponse) { startTimeInMs = System.currentTimeMillis(); FeedResponse feedResponse = (FeedResponse) value; logger.info("Request taking longer than {}ms diagnostic = {}", diagnosticsThresholdDuration.toMillis(), feedResponse.getCosmosDiagnostics().toString()); } } logger.debug("hookOnNext: {}, count:{}", value, count.get()); }
Source:
public void testMillisIsIndepedentOfOffset() throws ParseException { DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); Date date = format.parse("2010-06-29T23:20:00+0000"); Calendar cal1 = Calendar.getInstance(); cal1.setTimeZone(TimeZone.getTimeZone("GMT+00:00")); cal1.setTime(date); Timestamp t1 = Timestamp.forCalendar(cal1); Calendar cal2 = Calendar.getInstance(); cal2.setTimeZone(TimeZone.getTimeZone("GMT+02:00")); cal2.setTime(date); Timestamp t2 = Timestamp.forCalendar(cal2); assertEquals(t1.getMillis(), t2.getMillis()); assertEquals(t1.getDecimalMillis(), t2.getDecimalMillis()); }

Target:
public void testMillisIsIndepedentOfOffset() throws ParseException { DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); Date date = format.parse("2010-06-29T23:20:00+0000"); Calendar cal1 = Calendar.getInstance(); cal1.setTimeZone(TimeZone.getTimeZone("GMT+00:00")); cal1.setTime(date); Timestamp t1 = Timestamp.forCalendar(cal1); Calendar cal2 = Calendar.getInstance(); cal2.setTimeZone(TimeZone.getTimeZone("GMT+02:00")); cal2.setTime(date); Timestamp t2 = Timestamp.forCalendar(cal2); assertEquals(t1.getMillis(), date.getTime()); assertEquals(t2.getMillis(), date.getTime()); assertEquals(BigDecimal.valueOf(t1.getMillis()), t1.getDecimalMillis()); assertEquals(BigDecimal.valueOf(t2.getMillis()), t2.getDecimalMillis()); assertEquals(t1.getMillis(), t2.getMillis()); assertEquals(t1.getDecimalMillis(), t2.getDecimalMillis()); }
Source:
public static void addBundleToMap(Map<Object, String> map, IPluginModelBase bundle, String sl) { BundleDescription desc = bundle.getBundleDescription(); boolean defaultsl = (sl == null || sl.equals("default:default")); if (desc != null && defaultsl) { String modelName = desc.getSymbolicName(); if (IPDEBuildConstants.BUNDLE_DS.equals(modelName)) { map.put(bundle, "2:true"); } else if (IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR .equals(modelName)) { map.put(bundle, "1:true"); } else if (IPDEBuildConstants.BUNDLE_EQUINOX_COMMON .equals(modelName)) { map.put(bundle, "2:true"); } else if (IPDEBuildConstants.BUNDLE_OSGI.equals(modelName)) { map.put(bundle, "-1:true"); } else if (BUNDLE_UPDATE_CONFIGURATOR .equals(modelName)) { map.put(bundle, BundleLauncherHelper.DEFAULT_UPDATE_CONFIGURATOR_START_LEVEL); } else if (IPDEBuildConstants.BUNDLE_CORE_RUNTIME.equals(modelName)) { if (TargetPlatformHelper.getTargetVersion() > 4.1) { map.put(bundle, "default:true"); } else { map.put(bundle, "2:true"); } } else { map.put(bundle, sl); } } else { map.put(bundle, sl); } }

Target:
public static void addBundleToMap(Map<Object, String> map, IPluginModelBase bundle, String sl) { BundleDescription desc = bundle.getBundleDescription(); boolean defaultsl = (sl == null || sl.equals("default:default")); if (desc != null && defaultsl) { String modelName = desc.getSymbolicName(); if (IPDEBuildConstants.BUNDLE_DS.equals(modelName)) { map.put(bundle, "2:true"); } else if (IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR .equals(modelName)) { map.put(bundle, "1:true"); } else if (IPDEBuildConstants.BUNDLE_EQUINOX_COMMON .equals(modelName)) { map.put(bundle, "2:true"); } else if (IPDEBuildConstants.BUNDLE_OSGI.equals(modelName)) { map.put(bundle, "-1:true"); } else if (BUNDLE_UPDATE_CONFIGURATOR .equals(modelName)) { map.put(bundle, BundleLauncherHelper.DEFAULT_UPDATE_CONFIGURATOR_START_LEVEL); } else if (IPDEBuildConstants.BUNDLE_CORE_RUNTIME.equals(modelName)) { if (TargetPlatformHelper.getTargetVersion() >= 4.3) { map.put(bundle, "default:true"); } else { map.put(bundle, "2:true"); } } else { map.put(bundle, sl); } } else { map.put(bundle, sl); } }
Source:
public SearchRequestBuilder buildScrollSearchRequest() { String indices = index != null && !index.isEmpty() ? index : "_all"; SearchRequestBuilder searchRequestBuilder = client.prepareSearch(indices) .setTypes(type) .setSearchType(SearchType.QUERY_THEN_FETCH) .setScroll(new TimeValue(scrollTimeout.toMillis())) .setQuery(buildSearchQuery()) .setPreference("_shards:" + shard) .setSize(scrollSize); LOG.debug("ElasticSearch Request: " + searchRequestBuilder.toString()); return searchRequestBuilder; }

Target:
public SearchRequestBuilder buildScrollSearchRequest() { String indices = index != null && !index.isEmpty() ? index : "_all"; SearchRequestBuilder searchRequestBuilder = client.prepareSearch(indices) .setTypes(type) .setSearchType(QUERY_THEN_FETCH) .setScroll(new TimeValue(scrollTimeout.toMillis())) .setQuery(buildSearchQuery()) .setPreference("_shards:" + shard) .setSize(scrollSize); LOG.debug("ElasticSearch Request: %s" + searchRequestBuilder); return searchRequestBuilder; }
Source:
public Relationship byTypeValue(final String typeValue){ if(typeValue==null) { return null; } Relationship rel = null; try { rel = cache.getRelationshipByName(typeValue); if(rel != null && rel.getRelationTypeValue().equals(typeValue)) return rel; } catch (DotCacheException e) { Logger.debug(this.getClass(), "Unable to access the cache to obtain the relationship", e); } List<Map<String, Object>> results = new ArrayList<Map<String, Object>>(); try { final DotConnect dc = new DotConnect(); dc.setSQL(sql.FIND_BY_TYPE_VALUE); dc.addParam(typeValue.toLowerCase()); results = dc.loadObjectResults(); if (results.size() == 0) { return rel; } } catch (DotDataException e) { Logger.error(this,"Error getting relationships with typeValue: " + typeValue.toLowerCase()); } rel = new DbRelationshipTransformer(results).from(); if(rel!= null && InodeUtils.isSet(rel.getInode())){ cache.putRelationshipByInode(rel); } return rel; }

Target:
public Relationship byTypeValue(final String typeValue){ if(typeValue==null) { return null; } Relationship rel = null; try { rel = cache.getRelationshipByName(typeValue); if(rel != null && rel.getRelationTypeValue().equals(typeValue)) return rel; } catch (DotCacheException e) { Logger.debug(this.getClass(), "Unable to access the cache to obtain the relationship", e); } List<Map<String, Object>> results = new ArrayList<Map<String, Object>>(); try { final DotConnect dc = new DotConnect(); dc.setSQL(sql.FIND_BY_TYPE_VALUE); dc.addParam(typeValue.toLowerCase()); results = dc.loadObjectResults(); if (results.size() == 0) { return rel; } } catch (DotDataException e) { Logger.error(this,"Error getting relationships with typeValue: " + typeValue.toLowerCase(),e); } rel = new DbRelationshipTransformer(results).from(); if(rel!= null && InodeUtils.isSet(rel.getInode())){ cache.putRelationshipByInode(rel); } return rel; }
Source:
public boolean validate() { boolean isValid = true; setMessage(null); Iterable<EntityModel<GlusterVolumeSnapshotConfig>> items1 = getClusterConfigOptions().getItems(); if(getClusterConfigOptions().getItems() == null || getClusterConfigOptions().getItems().isEmpty()) { return false; } for (EntityModel<GlusterVolumeSnapshotConfig> model : items1) { GlusterVolumeSnapshotConfig option = model.getEntity(); if (option.getParamValue().trim().length() == 0) { setMessage(ConstantsManager.getInstance() .getMessages() .clusterSnapshotOptionValueEmpty(option.getParamName())); isValid = false; break; } } return isValid; }

Target:
public boolean validate() { boolean isValid = true; setMessage(null); if(getClusterConfigOptions().getItems() == null || getClusterConfigOptions().getItems().isEmpty()) { return false; } for (EntityModel<GlusterVolumeSnapshotConfig> model : getClusterConfigOptions().getItems()) { GlusterVolumeSnapshotConfig option = model.getEntity(); if (option.getParamValue().trim().length() == 0) { setMessage(ConstantsManager.getInstance() .getMessages() .clusterSnapshotOptionValueEmpty(option.getParamName())); isValid = false; break; } } return isValid; }
Source:
public void testConfigure() throws Descriptor.FormException { doNothing().when(desc).save(); StaplerRequest request = mock(StaplerRequest.class); desc.configure(request, json); verify(request).bindJSON(desc, json); }

Target:
public void testConfigure() throws Descriptor.FormException { doNothing().when(desc).save(); ServletContext servletContext = mock(ServletContext.class); WebApp webApp = new WebApp(servletContext); Stapler stapler = mock(Stapler.class); when(stapler.getWebApp()).thenReturn(webApp); HttpServletRequest servletRequest = mock(HttpServletRequest.class); TokenList tokenList = mock(TokenList.class); RequestImpl staplerRequest = new RequestImpl(stapler, servletRequest, new ArrayList<>(), tokenList); desc.configure(staplerRequest, json); assertThat(desc.isApplicable(AbstractProject.class), is(true)); assertThat(desc.getCredentialsId(), is("bitbucket-credentials")); assertThat(desc.isDisableInprogressNotification(), is(true)); assertThat(desc.getDisplayName(), is("Notify Stash Instance")); assertThat(desc.isIncludeBuildNumberInKey(), is(true)); assertThat(desc.isIgnoreUnverifiedSsl(), is(true)); assertThat(desc.isPrependParentProjectKey(), is(true)); assertThat(desc.getProjectKey(), is("JEN")); assertThat(desc.getStashRootUrl(), is("https://my.company.intranet/bitbucket")); }
Source:
public void testNoRepository() throws CoreException { ConnectProviderOperation operation = new ConnectProviderOperation( project.getProject()); operation.run(null); assertFalse(RepositoryProvider.isShared(project.getProject())); assertTrue(!gitDir.exists()); }

Target:
public void testNoRepository() throws CoreException { ConnectProviderOperation operation = new ConnectProviderOperation( project.getProject(), new File("../..", Constants.DOT_GIT)); operation.run(null); assertFalse(RepositoryProvider.isShared(project.getProject())); assertTrue(!gitDir.exists()); }
Source:
private static boolean isInstancePrimitive(@Nonnull Class<?> type, @Nonnull Object instance) { if (type.isInstance(instance)) { return true; } if (instance instanceof Number) { Number n = (Number) instance; if (type == Long.class || type == Double.class) { return true; } if (type == Integer.class && n.longValue() <= Integer.MAX_VALUE && n.longValue() >= Integer.MIN_VALUE) { return true; } } return false; }

Target:
private static boolean isInstancePrimitive(@Nonnull Class<?> type, @Nonnull Object instance) { if (type.isInstance(instance)) { return true; } if (instance instanceof Number) { if (type == Long.class && instance instanceof Integer) { return true; } if (type == Integer.class && instance instanceof Long) { Long n = (Long) instance; if (n >= Integer.MIN_VALUE && n <= Integer.MAX_VALUE) { return true; } } } return false; }
Source:
public void save(Subscription subscription, PartitionOffset partitionOffset) throws ExecutionException { OffsetCommitRequest commitRequest = createCommitRequest(subscription, partitionOffset); OffsetCommitResponse commitResponse; try { commitResponse = commitOffset(subscription, commitRequest); } catch (Exception e) { channels.invalidate(subscription); throw e; } if (commitResponse.hasError()) { for (Object error: commitResponse.errors().values()) { if ((Short) error == ErrorMapping.NotCoordinatorForConsumerCode() || (Short) error == ErrorMapping.ConsumerCoordinatorNotAvailableCode()) { channels.invalidate(subscription); break; } } throw new CannotCommitOffsetToBrokerException(new BrokerOffsetCommitErrors(commitResponse.errors())); } }

Target:
public void save(Subscription subscription, PartitionOffset partitionOffset) throws ExecutionException { OffsetCommitRequest commitRequest = createCommitRequest(subscription, partitionOffset); OffsetCommitResponse commitResponse; try { commitResponse = commitOffset(subscription, commitRequest); } catch (Exception e) { channels.invalidate(subscription); throw e; } if (commitResponse.hasError()) { commitResponse.errors().values() .stream() .map(error -> (Short) error) .filter(error -> error == ErrorMapping.NotCoordinatorForConsumerCode() || error == ErrorMapping.ConsumerCoordinatorNotAvailableCode()) .findAny() .ifPresent(error -> channels.invalidate(subscription)); throw new CannotCommitOffsetToBrokerException(new BrokerOffsetCommitErrors(commitResponse.errors())); } }
Source:
private void loadPreselectedReplays() { enterSearchingState(); replayService.getNewestReplaysWithMeta(TOP_ELEMENT_COUNT, 1) .thenAccept(replays -> populateReplays(replays.getFirst(), newestPane)) .thenCompose(aVoid -> replayService.getHighestRatedReplaysWithMeta(TOP_ELEMENT_COUNT, 1).thenAccept(highestRatedReplays -> populateReplays(highestRatedReplays.getFirst(), highestRatedPane))) .thenCompose(aVoid -> replayService.getOwnReplaysWithMeta(TOP_ELEMENT_COUNT, 1).thenAccept(highestRatedReplays -> populateReplays(highestRatedReplays.getFirst(), ownReplaysPane))) .thenRun(this::enterResultState) .exceptionally(throwable -> { logger.warn("Could not populate replays", throwable); return null; }); }

Target:
private void loadPreselectedReplays() { enterSearchingState(); replayService.getNewestReplaysWithPageCount(TOP_ELEMENT_COUNT, 1) .thenAccept(replays -> populateReplays(replays.getFirst(), newestPane)) .thenCompose(aVoid -> replayService.getHighestRatedReplaysWithPageCount(TOP_ELEMENT_COUNT, 1).thenAccept(highestRatedReplays -> populateReplays(highestRatedReplays.getFirst(), highestRatedPane))) .thenCompose(aVoid -> replayService.getOwnReplaysWithPageCount(TOP_ELEMENT_COUNT, 1).thenAccept(highestRatedReplays -> populateReplays(highestRatedReplays.getFirst(), ownReplaysPane))) .thenRun(this::enterShowRoomState) .exceptionally(throwable -> { logger.warn("Could not populate replays", throwable); return null; }); }
Source:
public void testSerializePeriod() throws Exception { ObjectMapper mapper = new DefaultObjectMapper(); String json = "{ \"type\": \"period\", \"period\": \"P1D\" }"; QueryGranularity gran = mapper.readValue(json, QueryGranularity.class); Assert.assertEquals(new PeriodGranularity(new Period("P1D"), null, null), gran); json = "{ \"type\": \"period\", \"period\": \"P1D\"," + "\"timeZone\": \"America/Los_Angeles\", \"origin\": \"1970-01-01T00:00:00Z\"}"; gran = mapper.readValue(json, QueryGranularity.class); Assert.assertEquals(new PeriodGranularity(new Period("P1D"), new DateTime(0L), DateTimeZone.forID("America/Los_Angeles")), gran); QueryGranularity expected = new PeriodGranularity( new Period("P1D"), new DateTime("2012-01-01"), DateTimeZone.forID("America/Los_Angeles") ); String jsonOut = mapper.writeValueAsString(expected); Assert.assertEquals(expected, mapper.readValue(jsonOut, QueryGranularity.class)); String illegalJson = "{ \"type\": \"period\", \"period\": \"P0D\" }"; try { mapper.readValue(illegalJson, QueryGranularity.class); } catch (JsonMappingException e) { Assert.assertEquals("zero period is not acceptable in QueryGranularity!", e.getCause().getMessage()); } }

Target:
public void testSerializePeriod() throws Exception { ObjectMapper mapper = new DefaultObjectMapper(); String json = "{ \"type\": \"period\", \"period\": \"P1D\" }"; QueryGranularity gran = mapper.readValue(json, QueryGranularity.class); Assert.assertEquals(new PeriodGranularity(new Period("P1D"), null, null), gran); json = "{ \"type\": \"period\", \"period\": \"P1D\"," + "\"timeZone\": \"America/Los_Angeles\", \"origin\": \"1970-01-01T00:00:00Z\"}"; gran = mapper.readValue(json, QueryGranularity.class); Assert.assertEquals(new PeriodGranularity(new Period("P1D"), new DateTime(0L), DateTimeZone.forID("America/Los_Angeles")), gran); QueryGranularity expected = new PeriodGranularity( new Period("P1D"), new DateTime("2012-01-01"), DateTimeZone.forID("America/Los_Angeles") ); String jsonOut = mapper.writeValueAsString(expected); Assert.assertEquals(expected, mapper.readValue(jsonOut, QueryGranularity.class)); String illegalJson = "{ \"type\": \"period\", \"period\": \"P0D\" }"; try { mapper.readValue(illegalJson, QueryGranularity.class); Assert.fail(); } catch (JsonMappingException e) { } }
Source:
public DitaClass(final String cls) { final String[] tokens = WHITESPACE.split(cls); final String last = tokens[tokens.length - 1]; matcher = ' ' + last + ' '; localName = last.substring(last.indexOf('/') + 1); final StringBuilder sb = new StringBuilder(); for (final String s: tokens) { sb.append(s).append(' '); } stringValue = sb.toString(); validDitaClass = (cls == null ? false : VALID_DITA_CLASS.matcher(stringValue).matches()); }

Target:
public DitaClass(final String cls) { final String[] tokens = WHITESPACE.split(cls); final String last = tokens[tokens.length - 1]; matcher = ' ' + last + ' '; localName = last.substring(last.indexOf('/') + 1); final StringBuilder sb = new StringBuilder(); for (final String s: tokens) { sb.append(s).append(' '); } stringValue = sb.toString(); validDitaClass = VALID_DITA_CLASS.matcher(stringValue).matches(); }
Source:
protected void onInitUI() { super.onInitUI(); createWidgets(); grid = new Grid(2, 2); grid.setStyleName(Gerrit.RESOURCES.css().infoBlock()); grid.setText(0, 0, Util.C.watchedProjectName()); grid.setWidget(0, 1, nameTxt); grid.setText(1, 0, Util.C.watchedProjectFilter()); grid.setWidget(1, 1, filterTxt); final CellFormatter fmt = grid.getCellFormatter(); fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost()); fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost()); fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().header()); fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().header()); fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().bottomheader()); final FlowPanel fp = new FlowPanel(); fp.setStyleName(Gerrit.RESOURCES.css().addWatchPanel()); fp.add(grid); fp.add(addNew); fp.add(browse); add(fp); add(watchesTab); add(delSel); projectListPopup = new ProjectListPopup(Util.C.projects(), PageLinks.SETTINGS_PROJECTS, nameTxt, null); projectListPopup .addOpenRowHandler(new ProjectListPopup.ProjectListPopupOnOpenRowHandler() { @Override public void onOpenProjectRow( ProjectListPopupOnOpenRowEvent projectListPopupEvent) { doAddNew(); } }); }

Target:
protected void onInitUI() { super.onInitUI(); createWidgets(); final Grid grid = new Grid(2, 2); grid.setStyleName(Gerrit.RESOURCES.css().infoBlock()); grid.setText(0, 0, Util.C.watchedProjectName()); grid.setWidget(0, 1, nameTxt); grid.setText(1, 0, Util.C.watchedProjectFilter()); grid.setWidget(1, 1, filterTxt); final CellFormatter fmt = grid.getCellFormatter(); fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost()); fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost()); fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().header()); fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().header()); fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().bottomheader()); final FlowPanel fp = new FlowPanel(); fp.setStyleName(Gerrit.RESOURCES.css().addWatchPanel()); fp.add(grid); fp.add(addNew); fp.add(browse); add(fp); add(watchesTab); add(delSel); final FlowPanel pfp = new FlowPanel(); sp = new ScrollPanel(projectsTab); sp.setSize("100%", "100%"); pfp.add(sp); pfp.add(close); popup.setWidget(pfp); popup.setHeight("100%"); popupPosition = new PopupPanel.PositionCallback() { public void setPosition(int offsetWidth, int offsetHeight) { int top = grid.getAbsoluteTop() - 50; int left = 5 + Math.max(grid.getAbsoluteLeft() + grid.getOffsetWidth(), watchesTab.getAbsoluteLeft() + watchesTab.getOffsetWidth()); if (top + offsetHeight > Window.getClientHeight()) { top = Window.getClientHeight() - offsetHeight; } if (left + offsetWidth > Window.getClientWidth()) { left = Window.getClientWidth() - offsetWidth; } if (top < 0) { sp.setHeight((sp.getOffsetHeight() + top) + "px"); top = 0; } if (left < 0) { sp.setWidth((sp.getOffsetWidth() + left) + "px"); left = 0; } popup.setPopupPosition(left, top); } }; }
Source:
private void addFileSystemFile(SleuthkitCase skCase, FsContent recycleBinFile, Content parentDir, String fileName, long deletedTime) throws TskCoreException { skCase.addFileSystemFile( recycleBinFile.getDataSourceObjectId(), recycleBinFile.getFileSystemId(), fileName, recycleBinFile.getMetaAddr(), (int) recycleBinFile.getMetaSeq(), recycleBinFile.getAttrType(), recycleBinFile.getAttributeId(), TskData.TSK_FS_NAME_FLAG_ENUM.UNALLOC, (short) (TskData.TSK_FS_META_FLAG_ENUM.UNALLOC.getValue() | TskData.TSK_FS_META_FLAG_ENUM.USED.getValue()), recycleBinFile.getSize(), 0, 0, 0, deletedTime, true, parentDir); }

Target:
private void addFileSystemFile(SleuthkitCase skCase, FsContent recycleBinFile, Content parentDir, String fileName, long deletedTime) throws TskCoreException { skCase.addFileSystemFile( recycleBinFile.getDataSourceObjectId(), recycleBinFile.getFileSystemId(), fileName, recycleBinFile.getMetaAddr(), (int) recycleBinFile.getMetaSeq(), recycleBinFile.getAttrType(), recycleBinFile.getAttributeId(), TskData.TSK_FS_NAME_FLAG_ENUM.UNALLOC, (short) (TskData.TSK_FS_META_FLAG_ENUM.UNALLOC.getValue() | TskData.TSK_FS_META_FLAG_ENUM.USED.getValue()), recycleBinFile.getSize(), recycleBinFile.getCtime(), recycleBinFile.getCrtime(), recycleBinFile.getAtime(), deletedTime, true, parentDir); }