auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void dataReadForUnknownStreamThatCouldntExistFail() throws Exception { when(connection.streamMayHaveExisted(STREAM_ID)).thenReturn(false); when(connection.stream(STREAM_ID)).thenReturn(null); final ByteBuf data = dummyData(); int padding = 10; int processedBytes = data.readableBytes() + padding; try { decode().onDataRead(ctx, STREAM_ID, data, padding, true); } catch (Http2Exception ex) { assertFalse(ex instanceof Http2Exception.StreamException); throw ex; } finally { try { verify(localFlow) .receiveFlowControlledFrame(eq((Http2Stream) null), eq(data), eq(padding), eq(true)); verify(localFlow).consumeBytes(eq((Http2Stream) null), eq(processedBytes)); verify(localFlow).frameWriter(any(Http2FrameWriter.class)); verifyNoMoreInteractions(localFlow); verify(listener, never()).onDataRead(eq(ctx), anyInt(), any(ByteBuf.class), anyInt(), anyBoolean()); } finally { data.release(); } } }

Target:
public void dataReadForUnknownStreamThatCouldntExistFail() throws Exception { when(connection.streamMayHaveExisted(STREAM_ID)).thenReturn(false); when(connection.stream(STREAM_ID)).thenReturn(null); final ByteBuf data = dummyData(); int padding = 10; int processedBytes = data.readableBytes() + padding; try { decode().onDataRead(ctx, STREAM_ID, data, padding, true); } catch (Http2Exception ex) { assertThat(ex, not(instanceOf(Http2Exception.StreamException.class))); throw ex; } finally { try { verify(localFlow) .receiveFlowControlledFrame(eq((Http2Stream) null), eq(data), eq(padding), eq(true)); verify(localFlow).consumeBytes(eq((Http2Stream) null), eq(processedBytes)); verify(localFlow).frameWriter(any(Http2FrameWriter.class)); verifyNoMoreInteractions(localFlow); verify(listener, never()).onDataRead(eq(ctx), anyInt(), any(ByteBuf.class), anyInt(), anyBoolean()); } finally { data.release(); } } }
Source:
public ItemCanteen() { this.addPropertyOverride(new ResourceLocation("filled"), new IItemPropertyGetter() { @Override @SideOnly(Side.CLIENT) public float apply(ItemStack stack, World world, EntityLivingBase entity) { WaterType waterType = getWaterType(stack); if (waterType == null) { return 0.0F; } else { return 1.0F; } } }); this.maxStackSize = 1; this.setNoRepair(); }

Target:
public ItemCanteen() { this.addPropertyOverride(new ResourceLocation("filled"), new IItemPropertyGetter() { @Override @SideOnly(Side.CLIENT) public float apply(ItemStack stack, World world, EntityLivingBase entity) { WaterType waterType = getWaterType(stack); if (waterType == null) return 0.0F; else return 1.0F; } }); this.maxStackSize = 1; this.setNoRepair(); }
Source:
protected void onLowMemory() { super.onResume(); swrve.onLowMemory(this); }

Target:
public void onLowMemory() { super.onResume(); swrve.onLowMemory(); }
Source:
public List<Diagnosis> getActiveDiagnoses(Patient patient) { Query query = sessionFactory.getCurrentSession().createQuery( "from Diagnosis d where d.patient.patientId = :patientId and d.voided = false " + "by d.dateCreated desc"); query.setInteger("patientId", patient.getId()); return query.list(); }

Target:
public List<Diagnosis> getActiveDiagnoses(Patient patient) { Query query = sessionFactory.getCurrentSession().createQuery( "from Diagnosis c where c.patient.patientId = :patientId and c.voided = false order " + "by c.onsetDate desc"); query.setInteger("patientId", patient.getId()); return query.list(); }
Source:
public void disconnect() { synchronized (partitions) { synchronized (pendingPartitions) { pendingPartitions.notifyAll(); } trimJob.cancel(); queueJob.cancel(); lld = null; document = null; inputPartitions = null; pendingPartitions.clear(); pendingSize = 0; partitions.clear(); } }

Target:
public void disconnect() { synchronized (pendingPartitions) { pendingPartitions.clear(); pendingSize = 0; pendingPartitions.notifyAll(); } synchronized (partitions) { trimJob.cancel(); queueJob.cancel(); lld = null; document = null; inputPartitions = null; partitions.clear(); } }
Source:
public Map<String, Object> action(Map<String, Object> moreInfo) throws Exception { try { System.out.println("Executing Blue Ocean and Declarative Pipeline compile hook"); PluginCompatTesterConfig config = (PluginCompatTesterConfig) moreInfo.get("config"); MavenCoordinates core = (MavenCoordinates) moreInfo.get("core"); runner = config.getExternalMaven() == null ? new InternalMavenRunner() : new ExternalMavenRunner(config.getExternalMaven()); mavenConfig = getMavenConfig(config); File pluginDir = (File) moreInfo.get("pluginDir"); if (pluginDir.exists()) Path pluginSourcesDir = config.getLocalCheckoutDir().toPath(); if (pluginSourcesDir != null) { boolean isMultipleLocalPlugins = config.getIncludePlugins() != null && config.getIncludePlugins().size() > 1; if (!isMultipleLocalPlugins) { pluginSourcesDir = pluginSourcesDir.getParent(); } Files.walk(pluginSourcesDir, 1) .filter(file -> isEslintFile(file)) .forEach(eslintrc -> copy(eslintrc, pluginDir)); } boolean ranCompile = moreInfo.containsKey(OVERRIDE_DEFAULT_COMPILE) ? (boolean) moreInfo.get(OVERRIDE_DEFAULT_COMPILE) : false; if (!ranCompile) { compile(mavenConfig, pluginDir); moreInfo.put(OVERRIDE_DEFAULT_COMPILE, true); } System.out.println("Executed Blue Ocean and Declarative Pipeline compile hook"); return moreInfo; } catch (Exception e) { System.out.println("Exception executing hook"); System.out.println(e); throw e; } }

Target:
public Map<String, Object> action(Map<String, Object> moreInfo) throws Exception { try { System.out.println("Executing Blue Ocean and Declarative Pipeline compile hook"); PluginCompatTesterConfig config = (PluginCompatTesterConfig) moreInfo.get("config"); MavenCoordinates core = (MavenCoordinates) moreInfo.get("core"); runner = config.getExternalMaven() == null ? new InternalMavenRunner() : new ExternalMavenRunner(config.getExternalMaven()); mavenConfig = getMavenConfig(config); File pluginDir = (File) moreInfo.get("pluginDir"); Path pluginSourcesDir = config.getLocalCheckoutDir().toPath(); if (pluginSourcesDir != null) { boolean isMultipleLocalPlugins = config.getIncludePlugins() != null && config.getIncludePlugins().size() > 1; if (!isMultipleLocalPlugins) { pluginSourcesDir = pluginSourcesDir.getParent(); } Files.walk(pluginSourcesDir, 1) .filter(file -> isEslintFile(file)) .forEach(eslintrc -> copy(eslintrc, pluginDir)); } boolean ranCompile = moreInfo.containsKey(OVERRIDE_DEFAULT_COMPILE) ? (boolean) moreInfo.get(OVERRIDE_DEFAULT_COMPILE) : false; if (!ranCompile) { compile(mavenConfig, pluginDir); moreInfo.put(OVERRIDE_DEFAULT_COMPILE, true); } System.out.println("Executed Blue Ocean and Declarative Pipeline compile hook"); return moreInfo; } catch (Exception e) { System.out.println("Exception executing hook"); System.out.println(e); throw e; } }
Source:
private void trackScreenView() { final String screenName = Analytics.Screens.FORUM_VIEW_TOPIC_THREADS; final String actionItem; Map<String, String> values = new HashMap<>(); String topicId = discussionTopic.getIdentifier(); if (DiscussionTopic.ALL_TOPICS_ID.equals(topicId)) { topicId = actionItem = Analytics.Values.POSTS_ALL; } else if (DiscussionTopic.FOLLOWING_TOPICS_ID.equals(topicId)) { topicId = actionItem = Analytics.Values.POSTS_FOLLOWING; } else { actionItem = discussionTopic.getName(); } values.put(Analytics.Keys.TOPIC_ID, topicId); environment.getAnalyticsRegistry().trackScreenView(screenName, courseData.getCourse().getId(), actionItem, values); }

Target:
private void trackScreenView() { final String actionItem; final Map<String, String> values = new HashMap<>(); String topicId = discussionTopic.getIdentifier(); if (DiscussionTopic.ALL_TOPICS_ID.equals(topicId)) { topicId = actionItem = Analytics.Values.POSTS_ALL; } else if (DiscussionTopic.FOLLOWING_TOPICS_ID.equals(topicId)) { topicId = actionItem = Analytics.Values.POSTS_FOLLOWING; } else { actionItem = discussionTopic.getName(); } values.put(Analytics.Keys.TOPIC_ID, topicId); environment.getAnalyticsRegistry().trackScreenView(Analytics.Screens.FORUM_VIEW_TOPIC_THREADS, courseData.getCourse().getId(), actionItem, values); }
Source:
public PTableKey(PName tenantId, String name) { Preconditions.checkNotNull(name); this.tenantId = tenantId; this.name = !name.contains(QueryConstants.NAMESPACE_SEPARATOR) ? name : name.replace(QueryConstants.NAMESPACE_SEPARATOR, QueryConstants.NAME_SEPARATOR); }

Target:
public PTableKey(PName tenantId, String name) { Preconditions.checkNotNull(name); this.tenantId = tenantId; this.name = name; }
Source:
public void sensitiveInfoInURLParamName() throws HttpMalformedHeaderException, URIException { String testURI = URI + "foo?bar=whodat&UserName=Jonathon&what=up"; HttpMessage msg = createHttpMessageWithRespBody(BODY); msg.getRequestHeader().setURI(new URI(testURI, false)); rule.scanHttpRequestSend(msg, -1); assertEquals(1, alertsRaised.size()); }

Target:
public void sensitiveInfoInURLParamName() throws HttpMalformedHeaderException, URIException { String sensitiveParamName = "UserName"; String sensitiveValue = "Jonathon"; String testURI = URI + "foo?bar=whodat&" + sensitiveParamName + "=" + sensitiveValue + "&what=up"; HttpMessage msg = createHttpMessageWithRespBody(testURI); rule.scanHttpRequestSend(msg, -1); assertEquals(1, alertsRaised.size()); assertEquals(sensitiveParamName, alertsRaised.get(0).getParam()); assertEquals(sensitiveValue, alertsRaised.get(0).getEvidence()); assertEquals( Constant.messages.getString( InformationDisclosureInURL.MESSAGE_PREFIX + "otherinfo.sensitiveinfo"), alertsRaised.get(0).getOtherInfo()); }
Source:
public String nextColumnOrNull() { String v = nextColumn(); if (v == null) { return null; } else if (v.isEmpty() && nullStringOrNull == null) { if (wasQuotedColumn) { return ""; } else { return null; } } else if (v.equals(nullStringOrNull)) { return null; } else { return v; } }

Target:
public String nextColumnOrNull() { String v = nextColumn(); if (nullStringOrNull == null) { if (v.isEmpty()) { if (wasQuotedColumn) { return ""; } else { return null; } } else { return v; } } else { if (v.equals(nullStringOrNull)) { return null; } else { return v; } } }
Source:
public static void registerCommand(ICommand command, String node, RegisteredPermValue permLevel) { if (permMap.containsKey(command)) { FMLLog.warning("Command %s tried to register a duplicate permission!", command); return; } permMap.put(command.getCommandName(), node); PermissionsManager.registerPermission(node, permLevel); CommandHandler ch = (CommandHandler) MinecraftServer.getServer().getCommandManager(); ch.registerCommand(command); }

Target:
public static void registerCommand(ICommand command, String node, RegisteredPermValue permLevel) { if (permMap.containsKey(command.getCommandName())) { FMLLog.warning("Command %s registered a duplicate permission!", command); } permMap.put(command.getCommandName(), node); PermissionsManager.registerPermission(node, permLevel); CommandHandler ch = (CommandHandler) MinecraftServer.getServer().getCommandManager(); ch.registerCommand(command); }
Source:
public void onCatch(Throwable caught) { if (caught instanceof IOException) { Utils.crossFade(loadProgress, networkError); } }

Target:
public void onCatch(Throwable caught) { Utils.crossFade(loadProgress, networkError); }
Source:
public GeoEntry queryById(String id) throws GeoEntryQueryException { LOGGER.debug("Suggestion query not implemented."); return null; }

Target:
public GeoEntry queryById(String id) throws GeoEntryQueryException { LOGGER.debug("Query by ID not query not implemented."); return null; }
Source:
public void testGetAuthorizedClients() { Long userId = BOOTSTRAP_PRINCIPAL.THE_ADMIN_USER.getPrincipalId(); String client1 = createSectorIdentifierAndClient(); String client2 = createSectorIdentifierAndClient(SECOND_SECTOR_IDENTIFIER, userId, "App 2"); OAuthRefreshTokenInformation token1 = createRefreshToken(client1, userId.toString(), new Date()); OAuthRefreshTokenInformation token2 = createRefreshToken(client1, userId.toString(), new Date(System.currentTimeMillis() - TWO_YEARS_MILLIS)); OAuthRefreshTokenInformation token3 = createRefreshToken(client2, userId.toString(), new Date(System.currentTimeMillis() - TWO_YEARS_MILLIS)); OAuthClientAuthorizationHistoryList results = oauthClientDao.getAuthorizedClientHistory(userId.toString(), null, 365L); long FIVE_MINUTES_AGO = System.currentTimeMillis() - FIVE_MINUTES_MILLIS; assertEquals(1, results.getResults().size()); assertEquals( client1,results.getResults().get(0).getClient().getClient_id()); assertTrue(FIVE_MINUTES_AGO < results.getResults().get(0).getAuthorizedOn().getTime()); assertTrue(FIVE_MINUTES_AGO < results.getResults().get(0).getLastUsed().getTime()); assertNull(results.getNextPageToken()); }

Target:
public void testGetAuthorizedClients() { Long userId = BOOTSTRAP_PRINCIPAL.THE_ADMIN_USER.getPrincipalId(); String client1 = createSectorIdentifierAndClient(); String client2 = createSectorIdentifierAndClient(SECOND_SECTOR_IDENTIFIER, userId, "App 2"); final Date client1ExpectedAuthzOn = new Date(System.currentTimeMillis() - ONE_YEAR_MILLIS * 5); final Date client1ExpectedLastUsed = new Date(System.currentTimeMillis() + ONE_YEAR_MILLIS * 5); createRefreshToken(client1, userId.toString(), client1ExpectedAuthzOn, new Date()); createRefreshToken(client1, userId.toString(), new Date(), new Date()); createRefreshToken(client1, userId.toString(), new Date(), client1ExpectedLastUsed); createRefreshToken(client1, userId.toString(), new Date(System.currentTimeMillis() - ONE_YEAR_MILLIS * 10), new Date(System.currentTimeMillis() - TWO_YEARS_MILLIS)); final Date client2ExpectedAuthzOn = new Date(System.currentTimeMillis() - 542326L); final Date client2ExpectedLastUsed = new Date(System.currentTimeMillis() - 54232L); createRefreshToken(client2, userId.toString(), client2ExpectedAuthzOn, client2ExpectedLastUsed); OAuthClientAuthorizationHistoryList results = oauthClientDao.getAuthorizedClientHistory(userId.toString(), null, ONE_YEAR_DAYS); assertEquals(2, results.getResults().size()); for (OAuthClientAuthorizationHistory result : results.getResults()) { if (result.getClient().getClient_id().equals(client1)) { assertEquals(client1ExpectedAuthzOn, result.getAuthorizedOn()); assertEquals(client1ExpectedLastUsed, result.getLastUsed()); } if (result.getClient().getClient_id().equals(client2)) { assertEquals(client2ExpectedAuthzOn, result.getAuthorizedOn()); assertEquals(client2ExpectedLastUsed, result.getLastUsed()); } } assertNull(results.getNextPageToken()); }
Source:
public static void refreshVisuals(final AbstractDiagramElementContainerEditPart self) { final DDiagramElement diagElement = self.resolveDiagramElement(); if (diagElement instanceof DDiagramElementContainer) { final DDiagramElementContainer ddec = (DDiagramElementContainer) diagElement; if (self.getBackgroundFigure() instanceof IWorkspaceImageFigure && ddec.getOwnedStyle() != null) { ((IWorkspaceImageFigure) self.getBackgroundFigure()).refreshFigure(ddec.getOwnedStyle()); } final ContainerStyle style = ddec.getOwnedStyle(); if (DiagramContainerEditPartOperation.isPrimaryShapeChanging(self, style)) { self.reInitFigure(); } ViewNodeContainerFigureDesc primaryShape = self.getPrimaryShape(); refreshBorder(self, primaryShape, style); if (primaryShape instanceof GradientRoundedRectangle) { refreshGradient(style, (GradientRoundedRectangle) primaryShape); } if (primaryShape instanceof RoundedRectangle) { refreshCorners(self, diagElement, (RoundedRectangle) primaryShape); } DiagramNodeEditPartOperation.refreshLabelAlignment(self.getContentPane(), ddec.getOwnedStyle()); } if (diagElement != null) { self.setTooltipText(diagElement.getTooltipText()); } }

Target:
public static void refreshVisuals(final AbstractDiagramElementContainerEditPart self) { final DDiagramElement diagElement = self.resolveDiagramElement(); if (diagElement instanceof DDiagramElementContainer) { final DDiagramElementContainer ddec = (DDiagramElementContainer) diagElement; if (self.getBackgroundFigure() instanceof IWorkspaceImageFigure && ddec.getOwnedStyle() != null) { ((IWorkspaceImageFigure) self.getBackgroundFigure()).refreshFigure(ddec.getOwnedStyle()); } final ContainerStyle style = ddec.getOwnedStyle(); if (DiagramContainerEditPartOperation.isPrimaryShapeChanging(self, style)) { self.reInitFigure(); } ViewNodeContainerFigureDesc primaryShape = self.getPrimaryShape(); refreshBorder(self, primaryShape, style); if (primaryShape instanceof GradientRoundedRectangle) { refreshGradient(style, (GradientRoundedRectangle) primaryShape); } if (primaryShape instanceof RoundedRectangle) { refreshCorners(self, diagElement, (RoundedRectangle) primaryShape); } DiagramElementEditPartOperation.refreshLabelAlignment(self.getContentPane(), ddec.getOwnedStyle()); } if (diagElement != null) { self.setTooltipText(diagElement.getTooltipText()); } }
Source:
private void readQueryParameters(HttpServerExchange exchange) { code = getQueryParameterIfPresent(exchange, OAuth2Constants.CODE); error = getQueryParameterIfPresent(exchange, OAuth2Constants.ERROR); errorDescription = getQueryParameterIfPresent(exchange, "error-description"); state = getQueryParameterIfPresent(exchange, OAuth2Constants.STATE); }

Target:
private void readQueryParameters(HttpServerExchange exchange) { code = getQueryParameterIfPresent(exchange, OAuth2Constants.CODE); error = getQueryParameterIfPresent(exchange, OAuth2Constants.ERROR); errorDescription = getQueryParameterIfPresent(exchange, OAuth2Constants.ERROR_DESCRIPTION); state = getQueryParameterIfPresent(exchange, OAuth2Constants.STATE); }
Source:
private static PlanNodeStatsEstimate compute( PlanNodeStatsEstimate sourceStats, PlanNodeStatsEstimate filteringSourceStats, Symbol sourceJoinSymbol, Symbol filteringSourceJoinSymbol, BiFunction<SymbolStatsEstimate, SymbolStatsEstimate, Double> retainedNdvProvider) { SymbolStatsEstimate sourceJoinSymbolStats = sourceStats.getSymbolStatistics(sourceJoinSymbol); SymbolStatsEstimate filteringSourceJoinSymbolStats = filteringSourceStats.getSymbolStatistics(filteringSourceJoinSymbol); double retainedNdv = retainedNdvProvider.apply(sourceJoinSymbolStats, filteringSourceJoinSymbolStats); double sourceDistinctValuesCount = sourceJoinSymbolStats.getDistinctValuesCount(); double filterFactor = sourceDistinctValuesCount == 0 ? 0 : (sourceJoinSymbolStats.getValuesFraction() * retainedNdv / sourceDistinctValuesCount); SymbolStatsEstimate newSourceJoinSymbolStats = SymbolStatsEstimate.buildFrom(sourceJoinSymbolStats) .setNullsFraction(0) .setDistinctValuesCount(retainedNdv) .build(); PlanNodeStatsEstimate outputStats = PlanNodeStatsEstimate.buildFrom(sourceStats) .addSymbolStatistics(sourceJoinSymbol, newSourceJoinSymbolStats) .setOutputRowCount(sourceStats.getOutputRowCount() * filterFactor) .build(); return outputStats; }

Target:
private static PlanNodeStatsEstimate compute( PlanNodeStatsEstimate sourceStats, PlanNodeStatsEstimate filteringSourceStats, Symbol sourceJoinSymbol, Symbol filteringSourceJoinSymbol, BiFunction<SymbolStatsEstimate, SymbolStatsEstimate, Double> retainedNdvProvider) { SymbolStatsEstimate sourceJoinSymbolStats = sourceStats.getSymbolStatistics(sourceJoinSymbol); SymbolStatsEstimate filteringSourceJoinSymbolStats = filteringSourceStats.getSymbolStatistics(filteringSourceJoinSymbol); double retainedNdv = retainedNdvProvider.apply(sourceJoinSymbolStats, filteringSourceJoinSymbolStats); SymbolStatsEstimate newSourceJoinSymbolStats = SymbolStatsEstimate.buildFrom(sourceJoinSymbolStats) .setNullsFraction(0) .setDistinctValuesCount(retainedNdv) .build(); double sourceDistinctValuesCount = sourceJoinSymbolStats.getDistinctValuesCount(); if (sourceDistinctValuesCount == 0) { return PlanNodeStatsEstimate.buildFrom(sourceStats) .addSymbolStatistics(sourceJoinSymbol, newSourceJoinSymbolStats) .setOutputRowCount(0) .build(); } double filterFactor = sourceJoinSymbolStats.getValuesFraction() * retainedNdv / sourceDistinctValuesCount; double outputRowCount = sourceStats.getOutputRowCount() * filterFactor; return PlanNodeStatsEstimate.buildFrom(sourceStats) .addSymbolStatistics(sourceJoinSymbol, newSourceJoinSymbolStats) .setOutputRowCount(outputRowCount) .build(); }
Source:
private List<OrderEntry> createSortOrder(IndexDefinition.IndexingRule rule) { if (sortOrder == null) { return Collections.emptyList(); } List<OrderEntry> orderEntries = newArrayListWithCapacity(sortOrder.size()); for (OrderEntry o : sortOrder) { PropertyDefinition pd = rule.getConfig(o.getPropertyName()); if (pd != null && pd.ordered && o.getPropertyType() != null && !o.getPropertyType().isArray()) { orderEntries.add(o); result.sortedProperties.add(pd); } else if (o.getPropertyName().equals(IndexDefinition.NATIVE_SORT_ORDER.getPropertyName())) { orderEntries.add(IndexDefinition.NATIVE_SORT_ORDER); } for (PropertyDefinition functionIndex : rule.getFunctionRestrictions()) { if (o.getPropertyName().equals(functionIndex.function) && functionIndex.ordered) { orderEntries.add(o); result.sortedProperties.add(functionIndex); } } } return orderEntries; }

Target:
private List<OrderEntry> createSortOrder(IndexDefinition.IndexingRule rule) { if (sortOrder == null) { return Collections.emptyList(); } List<OrderEntry> orderEntries = newArrayListWithCapacity(sortOrder.size()); for (OrderEntry o : sortOrder) { PropertyDefinition pd = rule.getConfig(o.getPropertyName()); if (pd != null && pd.ordered && o.getPropertyType() != null && !o.getPropertyType().isArray()) { orderEntries.add(o); result.sortedProperties.add(pd); } else if (o.getPropertyName().equals(IndexDefinition.NATIVE_SORT_ORDER.getPropertyName())) { orderEntries.add(IndexDefinition.NATIVE_SORT_ORDER); } for (PropertyDefinition functionIndex : rule.getFunctionRestrictions()) { if (functionIndex.ordered && o.getPropertyName().equals(functionIndex.function)) { orderEntries.add(o); result.sortedProperties.add(functionIndex); } } } return orderEntries; }
Source:
public void startTask(UUID resultId, UUID taskId) throws IllegalArgumentException { Result result = resultRepository.findOneWithChallenge(resultId); Task task = taskRepository.findOne(taskId); TaskResult taskResult = taskResultRepository.findOneByTaskAndResult(taskId, resultId); if (taskResult != null) { return; } TaskResultKey key = new TaskResultKey(); key.setTask(task); key.setResult(result); taskResult = new TaskResult(); taskResult.setKey(key); taskResult.setStartTime(ZonedDateTime.now()); taskResultRepository.save(taskResult); }

Target:
public void startTask(UUID resultId, UUID taskId) throws IllegalArgumentException { Result result = resultRepository.findOneWithChallenge(resultId); if (result == null) { throw new AccessDeniedException("result.invalid"); } Task task = taskRepository.findOne(taskId); if (task == null) { throw new AccessDeniedException("task.invalid"); } TaskResult taskResult = taskResultRepository.findOneByTaskAndResult(taskId, resultId); if (taskResult != null) { if (taskResult.getStartTime() != null) { throw new AccessDeniedException("task.denied"); } return; } TaskResultKey key = new TaskResultKey(); key.setTask(task); key.setResult(result); taskResult = new TaskResult(); taskResult.setKey(key); taskResult.setStartTime(ZonedDateTime.now()); taskResultRepository.save(taskResult); }
Source:
public BaseDto<ExtraLoanRateRuleDto> findExtraLoanRateRuleByNameAndProductType(String loanName, ProductType productType) { ExtraLoanRateRuleDto extraLoanRateRuleDto = new ExtraLoanRateRuleDto(); BaseDto<ExtraLoanRateRuleDto> baseDto = new BaseDto<>(extraLoanRateRuleDto); loanName = (loanName.indexOf("1") >= 0 || loanName.indexOf("2") >= 0) ? loanName.substring(0, loanName.length() - 5) : loanName; List<ExtraLoanRateRuleModel> extraLoanRateRuleModels = extraLoanRateRuleMapper.findExtraLoanRateRuleByNameAndProductType(loanName, productType); extraLoanRateRuleDto.setStatus(true); extraLoanRateRuleDto.setExtraLoanRateRuleModels(extraLoanRateRuleModels); return baseDto; }

Target:
public BaseDto<ExtraLoanRateRuleDto> findExtraLoanRateRuleByNameAndProductType(String loanName, ProductType productType) { ExtraLoanRateRuleDto extraLoanRateRuleDto = new ExtraLoanRateRuleDto(); BaseDto<ExtraLoanRateRuleDto> baseDto = new BaseDto<>(extraLoanRateRuleDto); List<ExtraLoanRateRuleModel> extraLoanRateRuleModels = extraLoanRateRuleMapper.findExtraLoanRateRuleByNameAndProductType(loanName, productType); extraLoanRateRuleDto.setStatus(true); extraLoanRateRuleDto.setExtraLoanRateRuleModels(extraLoanRateRuleModels); return baseDto; }
Source:
public String toString() { String mapper = declaringMapper != null ? declaringMapper.getType().getName().toString() : ""; String argument = getAssignment() != null ? getAssignment().toString() : getSourceReference(); List<String> arguments = sourceParameters.stream() .map( p -> p.isMappingContext() || p.isMappingTarget() || p.isTargetType() ? p.getName() : argument ) .collect( Collectors.toList() ); return returnType.getName() + " " + mapper + "#" + name + "(" + Strings.join( arguments, "," ) + ")"; }

Target:
public String toString() { String mapper = declaringMapper != null ? declaringMapper.getType().getName().toString() : ""; String argument = getAssignment() != null ? getAssignment().toString() : getSourceReference(); String returnTypeAsString = returnType != null ? returnType.toString() : ""; List<String> arguments = sourceParameters.stream() .map( p -> p.isMappingContext() || p.isMappingTarget() || p.isTargetType() ? p.getName() : argument ) .collect( Collectors.toList() ); return returnTypeAsString + " " + mapper + "#" + name + "(" + Strings.join( arguments, "," ) + ")"; }
Source:
private File getFile(String path, boolean create) throws IOException { File f = new File(getRepository().getWorkTree(), path); if (create) f.createNewFile(); return f; }

Target:
private File getFile(String path, boolean create) throws PatchApplyException { File f = new File(getRepository().getWorkTree(), path); if (create) try { FileUtils.createNewFile(f); } catch (IOException e) { throw new PatchApplyException(MessageFormat.format( JGitText.get().createNewFileFailed, f), e); } return f; }
Source:
public static void updateDuplicateWidgets(IManagedForm managedForm, AbstractWorkflowArtifact sma, XWidget xWidget, boolean fromHeader) { WorkDefinition workDef = (WorkDefinition) sma.getWorkDefinition(); String currStateName = sma.getStateDefinition().getName(); Object container = managedForm.getContainer(); WfeWorkFlowTab currWFE = null; if (container instanceof WfeWorkFlowTab) { currWFE = (WfeWorkFlowTab) container; } if (currWFE == null) { return; } WfeHeaderComposite headComp = currWFE.getHeader(); Collection<XWidget> headerWidgets = headComp.getXWidgets(new ArrayList<XWidget>()); List<StateXWidgetPage> statePages = currWFE.getStatePages(); Set<String> statePageNames = new HashSet<String>(); for (StateXWidgetPage sP : statePages) { statePageNames.add(sP.getName()); } if (!workDef.getDuplicatesMap().containsKey(xWidget.getLabel())) { return; } for (String key : workDef.getDuplicatesMap().get(xWidget.getLabel())) { if (!fromHeader && key.equals("Header Definition")) { for (XWidget currHeadWidget : headerWidgets) { if (currHeadWidget.getLabel().equals(xWidget.getLabel())) { if (!updateWidget(xWidget, currHeadWidget)) { break; } } } } if (!key.equals("Header Definition") && (key.equals(currStateName) || !statePageNames.contains(key))) { continue; } for (StateXWidgetPage currStatePage : statePages) { Collection<XWidget> updateWidgets = currStatePage.getDynamicXWidgetLayout().getXWidgets(); for (XWidget currUpdateWidget : updateWidgets) { if (currUpdateWidget.getLabel().equals(xWidget.getLabel())) { if (!updateWidget(xWidget, currUpdateWidget)) { break; } } } } } }

Target:
public static void updateDuplicateWidgets(IManagedForm managedForm, AbstractWorkflowArtifact sma, XWidget xWidget, boolean fromHeader) { WorkDefinition workDef = (WorkDefinition) sma.getWorkDefinition(); String currStateName = sma.getStateDefinition().getName(); Object container = managedForm.getContainer(); WfeWorkFlowTab currWFE = null; if (container instanceof WfeWorkFlowTab) { currWFE = (WfeWorkFlowTab) container; } else { return; } WfeHeaderComposite headComp = currWFE.getHeader(); Collection<XWidget> headerWidgets = headComp.getXWidgets(new ArrayList<XWidget>()); List<StateXWidgetPage> statePages = currWFE.getStatePages(); Set<String> statePageNames = new HashSet<String>(); for (StateXWidgetPage sP : statePages) { statePageNames.add(sP.getName()); } if (!workDef.getDuplicatesMap().containsKey(xWidget.getLabel())) { return; } for (String key : workDef.getDuplicatesMap().get(xWidget.getLabel())) { if (!fromHeader && key.equals("Header Definition")) { for (XWidget currHeadWidget : headerWidgets) { if (currHeadWidget.getLabel().equals(xWidget.getLabel())) { if (!updateWidget(xWidget, currHeadWidget)) { break; } } } } if (!key.equals("Header Definition") && (key.equals(currStateName) || !statePageNames.contains(key))) { continue; } for (StateXWidgetPage currStatePage : statePages) { Collection<XWidget> updateWidgets = currStatePage.getDynamicXWidgetLayout().getXWidgets(); for (XWidget currUpdateWidget : updateWidgets) { if (currUpdateWidget.getLabel().equals(xWidget.getLabel())) { if (!updateWidget(xWidget, currUpdateWidget)) { break; } } } } } }
Source:
public List<String> listAll() { if (!basePath.toFile().exists() || !basePath.toFile().isDirectory()) { throw new IllegalArgumentException("Invalid base path: " + basePath); } return Arrays.asList(basePath.toFile().list((dir, name) -> new File(dir, name).isDirectory())); }

Target:
public List<String> listAll() { try { return Files.list(basePath).filter(Files::isDirectory).map(Path::getFileName).map(Path::toString).collect( Collectors.toList()); } catch (IOException e) { throw new IllegalArgumentException("Invalid base path: " + basePath, e); } }
Source:
private Injector createInjector(InjectorConfig config) { List<Module> modules = new ArrayList<Module>(); InjectorConfig current = config; do { modules.addAll(current.getModules()); InjectorConfig parent = null; if (current.hasParent()) { String parentName = current.getParentName(); parent = configByName.get(parentName); if (parent == null) { LOG.info("Can't create as its ancestor can't be found", new Object[] { config.getName(), parentName }); return null; } } current = parent; } while (current != null); try { Injector injector = Guice.createInjector(modules); for (InjectorLifecycleListener listener : listeners) { listener.injectorCreated(injector, config); } return injector; } catch (CreationException e) { config.getListener().creationFailed(); return null; } }

Target:
private Injector createInjector(InjectorConfig config) { List<Module> modules = new ArrayList<Module>(); InjectorConfig current = config; do { modules.addAll(current.getModules()); InjectorConfig parent = null; if (current.hasParent()) { String parentName = current.getParentName(); parent = configByName.get(parentName); if (parent == null) { LOG.info("Can't create as its ancestor can't be found", new Object[] { config.getName(), parentName }); return null; } } current = parent; } while (current != null); try { Injector injector = Guice.createInjector(modules); for (InjectorLifecycleListener listener : listeners) { listener.injectorCreated(injector, config); } return injector; } catch (CreationException e) { LOG.error("Can't create injector " + config.getName(), e); config.getListener().creationFailed(); return null; } }
Source:
private HostnameVerifier chooseHostnameVerifier() { HostnameVerifier hostnameVerifier; if (configuration.isVerifyHostname()) { if (verifier == null) { hostnameVerifier = SSLConnectionSocketFactory.getDefaultHostnameVerifier(); } else { hostnameVerifier = verifier; } } else { hostnameVerifier = new NoopHostnameVerifier(); } return hostnameVerifier; }

Target:
private HostnameVerifier chooseHostnameVerifier() { if (configuration.isVerifyHostname()) { return verifier != null ? verifier : SSLConnectionSocketFactory.getDefaultHostnameVerifier(); } else { return new NoopHostnameVerifier(); } }
Source:
public void setUp() throws Exception { super.setUp(); assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_3)); assumeTrue("Server have been complied --with-libxml",isXmlEnabled(con)); Statement stmt = con.createStatement(); stmt.execute("CREATE TEMP TABLE xmltest(id int primary key, val xml)"); stmt.execute("INSERT INTO xmltest VALUES (1, '" + _xmlDocument + "')"); stmt.execute("INSERT INTO xmltest VALUES (2, '" + _xmlFragment + "')"); stmt.close(); }

Target:
public void setUp() throws Exception { super.setUp(); assumeMinimumServerVersion(ServerVersion.v8_3); assumeTrue("Server has been compiled --with-libxml", isXmlEnabled(con)); Statement stmt = con.createStatement(); stmt.execute("CREATE TEMP TABLE xmltest(id int primary key, val xml)"); stmt.execute("INSERT INTO xmltest VALUES (1, '" + _xmlDocument + "')"); stmt.execute("INSERT INTO xmltest VALUES (2, '" + _xmlFragment + "')"); stmt.close(); }
Source:
public void onInitBeforeLoadTemplate(LiveStreamTranscoder liveStreamTranscoder) { String template = liveStreamTranscoder.getTemplateName(); logger.info("Template name is "+template); IMediaStream stream = liveStreamTranscoder.getStream(); WMSProperties props = stream.getProperties(); AMFDataObj obj; synchronized (props) { obj = (AMFDataObj) props.getProperty(AMFSETDATAFRAME); } if (obj == null){ logger.info("Cant find property AMFDataObj for stream " + stream.getName()); return; } for (String streamParam: streamParams) { if (obj.containsKey(streamParam)){ template = updateTemplate(obj, streamParam, template); } } liveStreamTranscoder.setTemplateName(template); logger.info("New Template name is "+liveStreamTranscoder.getTemplateName()); }

Target:
public void onInitBeforeLoadTemplate(LiveStreamTranscoder liveStreamTranscoder) { String template = liveStreamTranscoder.getTemplateName(); IMediaStream stream = liveStreamTranscoder.getStream(); logger.info("[" + stream.getName() +" ] Template name is "+template); WMSProperties props = stream.getProperties(); AMFDataObj obj; synchronized (props) { obj = (AMFDataObj) props.getProperty(AMFSETDATAFRAME); } if (obj == null){ logger.info("[" + stream.getName() +" ] Cant find property AMFDataObj for stream " + stream.getName()); return; } for (String streamParam: streamParams) { if (obj.containsKey(streamParam)){ template += '/' + streamParam + '/' + obj.getString(streamParam); } } liveStreamTranscoder.setTemplateName(template); logger.info("[" + stream.getName() +" ] New Template name is "+liveStreamTranscoder.getTemplateName()); }
Source:
public int run(String[] args) { for (Map.Entry<String, Command> entry : commands.entrySet()) { jc.addCommand(entry.getKey(), entry.getValue()); } try { jc.parse(args); } catch (Exception e) { LOGGER.error("Failed to parse parameters. " + e.getMessage() + "\n"); printUsage(null); return RC_ERR; } if (jc.getParameters().get(0).isAssigned()) { printUsage(null); return RC_OK; } if (jc.getParsedCommand() == null) { MesosCluster cluster = ClusterRepository.loadCluster(); if (cluster != null) { cluster.printServiceUrls(output); return RC_OK; } else { printUsage(null); return RC_ERR; } } Command parsedCommand = commands.get(jc.getParsedCommand()); if (parsedCommand == null) { LOGGER.error("No such command: " + jc.getParsedCommand()); return RC_ERR; } else if (CommandHelp.CLINAME.equals(parsedCommand.getName())) { printUsage(null); } else { if (parsedCommand.validateParameters()) { parsedCommand.execute(); } else { printUsage(jc.getParsedCommand()); return RC_ERR; } } return RC_OK; }

Target:
public int run(String[] args) { for (Map.Entry<String, Command> entry : commands.entrySet()) { jc.addCommand(entry.getKey(), entry.getValue()); } try { jc.parse(args); } catch (Exception e) { LOGGER.error("Failed to parse parameters. " + e.getMessage() + "\n"); printUsage(null); return EXIT_CODE_ERR; } if (jc.getParameters().get(0).isAssigned()) { printUsage(null); return EXIT_CODE_OK; } if (jc.getParsedCommand() == null) { MesosCluster cluster = ClusterRepository.loadCluster(); if (cluster != null) { cluster.printServiceUrls(output); return EXIT_CODE_OK; } else { printUsage(null); return EXIT_CODE_ERR; } } Command parsedCommand = commands.get(jc.getParsedCommand()); if (parsedCommand == null) { LOGGER.error("No such command: " + jc.getParsedCommand()); return EXIT_CODE_ERR; } else if (CommandHelp.CLINAME.equals(parsedCommand.getName())) { printUsage(null); } else { if (parsedCommand.validateParameters()) { parsedCommand.execute(); } else { printUsage(jc.getParsedCommand()); return EXIT_CODE_ERR; } } return EXIT_CODE_OK; }
Source:
public void contextInitialized(ServletContextEvent event) { context = event.getServletContext(); context.setAttribute(Bootstrap.class.getName(),this); try { final FileAndDescription describedHomeDir = getHomeDir(event); home = describedHomeDir.file.getAbsoluteFile(); home.mkdirs(); System.out.println("Jenkins home directory: "+ home +" found at: "+describedHomeDir.description); if (!home.exists()) throw new Error("Invalid JENKINS_HOME: "+ home); recordBootAttempt(home); coreClassLoader = buildCoreClassLoader(); Thread.currentThread().setContextClassLoader(coreClassLoader); bootLogics = loadBootLogics(coreClassLoader); for (BootLogic b : bootLogics) { b.contextInitialized(event); } } catch (Error | RuntimeException e) { LOGGER.log(SEVERE, "Failed to initialize Jenkins",e); throw e; } catch (Exception e) { LOGGER.log(SEVERE, "Failed to initialize Jenkins",e); throw new Error(e); } }

Target:
public void contextInitialized(ServletContextEvent event) { context = event.getServletContext(); context.setAttribute(Bootstrap.class.getName(),this); try { final FileAndDescription describedHomeDir = getHomeDir(event); home = describedHomeDir.file.getAbsoluteFile(); home.mkdirs(); System.out.println("Jenkins home directory: "+ home +" found at: "+describedHomeDir.description); if (!home.exists()) throw new Error("Invalid JENKINS_HOME: "+ home); recordBootAttempt(home); coreClassLoader = buildCoreClassLoader(); Thread.currentThread().setContextClassLoader(coreClassLoader); bootLogics = loadBootLogics(coreClassLoader); for (BootLogic b : bootLogics) { b.contextInitialized(event); } } catch (IOException e) { LOGGER.log(SEVERE, "Failed to initialize Jenkins",e); throw new Error(e); } catch (final Throwable e) { LOGGER.log(SEVERE, "Failed to initialize Jenkins",e); throw e; } }
Source:
private void addFeatureRemoveTemplateFromSD(Features features) { Feature feature = new Feature(); feature.setName("Remove Template From Specific Storage-Domain"); feature.setDescription("Ability to remove template images from a specific storage-domain: DELETE .../api/storagedomains/{storagedomain:id}/templates/{template:id}"); features.getFeature().add(feature); }

Target:
private void addFeatureRemoveTemplateFromSD(Features features) { Feature feature = new Feature(); feature.setName("Remove Template Disks From Specified Storage-Domain"); feature.setDescription("Ability to remove template images from a specific storage-domain: DELETE .../api/templates/{template:id}/disks/{disk:id}, supplying <action><storage_domain id=\"xxx\"</storage_domain></action>"); features.getFeature().add(feature); }
Source:
public static void update(IJavaProject javaProject, OmniEclipseProject project, SubMonitor progress) throws JavaModelException { if (Platform.getBundle("org.eclipse.wst.common.core") != null) { List<OmniExternalDependency> dependencies = project.getExternalDependencies(); String deploymentPath = getDeploymentPath(dependencies); if (deploymentPath != null) { updateDeploymentPath(javaProject, deploymentPath, progress); } else if (hasNonDeploymentAttributes(dependencies)) { markAsNonDeployed(javaProject, progress); } } }

Target:
public static void update(IJavaProject javaProject, OmniEclipseProject project, SubMonitor progress) throws JavaModelException { if (CorePlugin.workspaceOperations().isWtpInstalled()) { List<OmniExternalDependency> dependencies = project.getExternalDependencies(); String deploymentPath = getDeploymentPath(dependencies); if (deploymentPath != null) { updateDeploymentPath(javaProject, deploymentPath, progress); } else if (hasNonDeploymentAttributes(dependencies)) { markAsNonDeployed(javaProject, progress); } } }
Source:
void setMarker(TextMarker marker, int length) { this.marker = marker; numSkipLines = length; if (checkAndUpdateArrows()) { upArrow.setHTML(PatchUtil.M.expandBefore(NUM_ROWS_TO_EXPAND)); downArrow.setHTML(PatchUtil.M.expandAfter(NUM_ROWS_TO_EXPAND)); } skipNum.setText(PatchUtil.C.patchSkipRegion(Integer .toString(length))); }

Target:
void setMarker(TextMarker marker, int length) { this.marker = marker; numSkipLines = length; if (checkAndUpdateArrows()) { upArrow.setHTML(PatchUtil.M.expandBefore(NUM_ROWS_TO_EXPAND)); downArrow.setHTML(PatchUtil.M.expandAfter(NUM_ROWS_TO_EXPAND)); } skipNum.setText(PatchUtil.M.patchSkipRegion(Integer .toString(length))); }
Source:
protected void endVmCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { final boolean taskGroupSucceeded = getParameters().getTaskGroupSuccess(); Guid createdSnapshotId = getSnapshotDao().getId(getVmId(), getParameters().getSnapshotType(), SnapshotStatus.LOCKED); if (taskGroupSucceeded) { getSnapshotDao().updateStatus(createdSnapshotId, SnapshotStatus.OK); if (getParameters().getParentCommand() != VdcActionType.RunVm && getVm() != null && getVm().isStatusUp() && getVm().getRunOnVds() != null) { performLiveSnapshot(createdSnapshotId); } } else { revertToActiveSnapshot(createdSnapshotId); } getVmStaticDAO().incrementDbGeneration(getVm().getId()); endActionOnDisks(); setSucceeded(taskGroupSucceeded); getReturnValue().setEndActionTryAgain(false); return null; } }); if (getVm().isAutoStartup() && isVmDownUnintentionally() && getParameters().getInitialVmStatus() != VMStatus.Down) { Backend.getInstance().runInternalAction(VdcActionType.RunVm, new RunVmParams(getVmId()), ExecutionHandler.createInternalJobContext()); } }

Target:
protected void endVmCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { final boolean taskGroupSucceeded = getParameters().getTaskGroupSuccess(); Guid createdSnapshotId = getSnapshotDao().getId(getVmId(), getParameters().getSnapshotType(), SnapshotStatus.LOCKED); if (taskGroupSucceeded) { getSnapshotDao().updateStatus(createdSnapshotId, SnapshotStatus.OK); if (getParameters().getParentCommand() != VdcActionType.RunVm && getVm() != null && getVm().isStatusUp() && getVm().getRunOnVds() != null) { performLiveSnapshot(createdSnapshotId); } } else { revertToActiveSnapshot(createdSnapshotId); } getVmStaticDAO().incrementDbGeneration(getVm().getId()); endActionOnDisks(); setSucceeded(taskGroupSucceeded); getReturnValue().setEndActionTryAgain(false); return null; } }); if (getVm() != null && getVm().isAutoStartup() && isVmDownUnintentionally() && getParameters().getInitialVmStatus() != VMStatus.Down) { Backend.getInstance().runInternalAction(VdcActionType.RunVm, new RunVmParams(getVmId()), ExecutionHandler.createInternalJobContext()); } }
Source:
public void testSaveToKeyValueCacheWithoutCacheDir() throws Exception { File keyValueCacheDir = new File(temporaryFolder.getRoot(), "ParseKeyValueCache"); assertTrue(keyValueCacheDir.exists()); keyValueCacheDir.delete(); assertFalse(keyValueCacheDir.exists()); ParseKeyValueCache.saveToKeyValueCache("key", "value"); assertEquals(1, keyValueCacheDir.listFiles().length); assertArrayEquals( "value".getBytes(), ParseFileUtils.readFileToByteArray(keyValueCacheDir.listFiles()[0])); }

Target:
public void testSaveToKeyValueCacheWithoutCacheDir() throws Exception { assertTrue(keyValueCacheDir.exists()); keyValueCacheDir.delete(); assertFalse(keyValueCacheDir.exists()); ParseKeyValueCache.saveToKeyValueCache("key", "value"); assertEquals(1, keyValueCacheDir.listFiles().length); assertArrayEquals( "value".getBytes(), ParseFileUtils.readFileToByteArray(keyValueCacheDir.listFiles()[0])); }
Source:
public void deleteDocument(Exchange exchange) throws Exception { validateRequiredHeader(exchange, CamelCMISConstants.CMIS_OBJECT_ID); Message message = exchange.getIn(); String objectId = message.getHeader(CamelCMISConstants.CMIS_OBJECT_ID, String.class); Boolean allVersions = Boolean.valueOf(message.getHeader(CamelCMISConstants.ALL_VERSIONS, String.class)); Document document = (Document) getSessionFacade().getObjectById(objectId); document.delete(allVersions); }

Target:
public void deleteDocument(Exchange exchange) throws Exception { validateRequiredHeader(exchange, CamelCMISConstants.CMIS_OBJECT_ID); Message message = exchange.getIn(); String objectId = message.getHeader(CamelCMISConstants.CMIS_OBJECT_ID, String.class); Boolean allVersions = message.getHeader(CamelCMISConstants.ALL_VERSIONS, Boolean.class); Document document = (Document) getSessionFacade().getObjectById(objectId); document.delete(allVersions); }
Source:
public WellKnownImage(@Nullable String loginUser, String uuid, String description, OsFamily osFamily, @Nullable String osVersion, int size, @Nullable Boolean is64bit) { this.loginUser = firstNonNull(loginUser, DEFAULT_USER); this.uuid = checkNotNull(uuid, "uuid cannot be mull"); this.description = checkNotNull(description, "description cannot be mull"); this.osFamily = checkNotNull(osFamily, "osFamily cannot be mull"); this.osVersion = osVersion; this.size = size; this.is64bit = firstNonNull(is64bit, Boolean.TRUE); }

Target:
public WellKnownImage(@Nullable String loginUser, String uuid, String description, OsFamily osFamily, @Nullable String osVersion, int size, @Nullable Boolean is64bit) { this.loginUser = firstNonNull(loginUser, DEFAULT_USER); this.uuid = checkNotNull(uuid, "uuid cannot be null"); this.description = checkNotNull(description, "description cannot be null"); this.osFamily = checkNotNull(osFamily, "osFamily cannot be null"); this.osVersion = osVersion; this.size = size; this.is64bit = firstNonNull(is64bit, Boolean.TRUE); }
Source:
private void createAuditTable(final IDBI dbi, final String tableName) { createTable( dbi, tableName, ImmutableList.of( String.format( "CREATE TABLE %1$s (\n" + " id %2$s NOT NULL,\n" + " auditkey VARCHAR(255) NOT NULL,\n" + " author VARCHAR(255) NOT NULL,\n" + " emailid VARCHAR(255) NOT NULL,\n" + " comment VARCHAR(2048) NOT NULL,\n" + " audit_time VARCHAR(255) NOT NULL,\n" + " config_payload %3$s NOT NULL,\n" + " PRIMARY KEY(id)\n" + ")", tableName, getSerialType(), getPayloadType() ), String.format("CREATE INDEX idx_%1$s_auditkey_time ON %1$s(auditkey, audit_time)", tableName), String.format("CREATE INDEX idx_%1$s_audit_time ON %1$s(audit_time)", tableName) ) ); }

Target:
private void createAuditTable(final IDBI dbi, final String tableName) { createTable( dbi, tableName, ImmutableList.of( String.format( "CREATE TABLE %1$s (\n" + " id %2$s NOT NULL,\n" + " audit_key VARCHAR(255) NOT NULL,\n" + " type VARCHAR(255) NOT NULL,\n" + " author VARCHAR(255) NOT NULL,\n" + " comment VARCHAR(2048) NOT NULL,\n" + " created_date VARCHAR(255) NOT NULL,\n" + " payload %3$s NOT NULL,\n" + " PRIMARY KEY(id)\n" + ")", tableName, getSerialType(), getPayloadType() ), String.format("CREATE INDEX idx_%1$s_key_time ON %1$s(audit_key, created_date)", tableName), String.format("CREATE INDEX idx_%1$s_type_time ON %1$s(audit_key, created_date)", tableName), String.format("CREATE INDEX idx_%1$s_audit_time ON %1$s(created_date)", tableName) ) ); }