auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void build_createANewRadiologyOrderSearchCriteriaInstanceWithAccessionNumberIfAccessionNumberIsSet() throws Exception { String accessionNumber = "1"; radiologyOrderSearchCriteria = new RadiologyOrderSearchCriteria.Builder().withAccessionNumber(accessionNumber) .build(); assertTrue(radiologyOrderSearchCriteria.getAccessionNumber() .equals(accessionNumber)); assertNull(radiologyOrderSearchCriteria.getPatient()); assertFalse(radiologyOrderSearchCriteria.getIncludeVoided()); assertNull(radiologyOrderSearchCriteria.getUrgency()); assertNull(radiologyOrderSearchCriteria.getFromEffectiveStartDate()); assertNull(radiologyOrderSearchCriteria.getToEffectiveStartDate()); }

Target:
public void build_createANewRadiologyOrderSearchCriteriaInstanceWithAccessionNumberIfAccessionNumberIsSet() throws Exception { String accessionNumber = "1"; radiologyOrderSearchCriteria = new RadiologyOrderSearchCriteria.Builder().withAccessionNumber(accessionNumber) .build(); assertThat(radiologyOrderSearchCriteria.getAccessionNumber(), is(accessionNumber)); assertNull(radiologyOrderSearchCriteria.getPatient()); assertFalse(radiologyOrderSearchCriteria.getIncludeVoided()); assertNull(radiologyOrderSearchCriteria.getUrgency()); assertNull(radiologyOrderSearchCriteria.getFromEffectiveStartDate()); assertNull(radiologyOrderSearchCriteria.getToEffectiveStartDate()); }
Source:
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { for (ChannelSecurityInterceptor securityInterceptor : securityInterceptors) { ChannelSecurityMetadataSource channelSecurityMetadataSource = (ChannelSecurityMetadataSource) securityInterceptor.obtainSecurityMetadataSource(); if (bean instanceof MessageChannel && this.shouldProxy(beanName, channelSecurityMetadataSource)) { if (AopUtils.isAopProxy(bean) && bean instanceof Advised) { ((Advised) bean).addAdvisor(new DefaultPointcutAdvisor(securityInterceptor)); } else { ProxyFactory proxyFactory = new ProxyFactory(bean); proxyFactory.addAdvisor(new DefaultPointcutAdvisor(securityInterceptor)); bean = proxyFactory.getProxy(); } } } return bean; }

Target:
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof MessageChannel) { for (ChannelSecurityInterceptor securityInterceptor : securityInterceptors) { ChannelSecurityMetadataSource channelSecurityMetadataSource = (ChannelSecurityMetadataSource) securityInterceptor.obtainSecurityMetadataSource(); if (this.shouldProxy(beanName, channelSecurityMetadataSource)) { if (AopUtils.isAopProxy(bean) && bean instanceof Advised) { ((Advised) bean).addAdvisor(new DefaultPointcutAdvisor(securityInterceptor)); } else { ProxyFactory proxyFactory = new ProxyFactory(bean); proxyFactory.addAdvisor(new DefaultPointcutAdvisor(securityInterceptor)); bean = proxyFactory.getProxy(); } } } } return bean; }
Source:
public void testEmptyRowSet() { RowSet in = RowSet.newBuilder().build(); RangeSet<RowKeyWrapper> out = adapter.rowSetToRangeSet(in); assertEquals(ImmutableRangeSet.builder().build(), out); Query query = Query.create(TABLE_ID); adapter.rangeSetToByteStringRange(out, query); assertEquals(in, query.toProto(requestContext).getRows()); }

Target:
public void testEmptyRowSet() { RowSet in = RowSet.newBuilder().build(); RangeSet<RowKeyWrapper> out = adapter.rowSetToRangeSet(in); assertEquals(ImmutableRangeSet.builder().build(), out); adapter.rangeSetToByteStringRange(out, query); assertEquals(in, query.toProto(requestContext).getRows()); }
Source:
@Test void digestIsNormalized() { final RexNode node0 = and( or(input(tBool(), 1), input(tBool(), 0)), input(tBool(), 0)); final RexNode node1 = and( input(tBool(), 0), or(input(tBool(), 0), input(tBool(), 1))); assertThat(node0.equals(node1), is(true)); final RexNode node2 = eq(input(tVarchar(), 0), literal("0123456789012345")); final RexNode node3 = eq(literal("0123456789012345"), input(tVarchar(), 0)); assertThat(node2.equals(node3), is(true)); final RexNode node4 = eq(input(tVarchar(), 0), literal("01")); final RexNode node5 = eq(literal("01"), input(tVarchar(), 0)); assertThat(node4.equals(node5), is(true)); }

Target:
@Test void digestIsNormalized() { assertNodeEquals( and(or(vBool(1), vBool(0)), vBool(0)), and(vBool(0), or(vBool(0), vBool(1)))); assertNodeEquals( and(or(vBool(1), vBool(0)), vBool(0)), and(or(vBool(0), vBool(1)), vBool(0))); assertNodeEquals( eq(vVarchar(0), literal("0123456789012345")), eq(literal("0123456789012345"), vVarchar(0))); assertNodeEquals( eq(vVarchar(0), literal("01")), eq(literal("01"), vVarchar(0))); }
Source:
private void closeSession() { if (session == null) return; debug("attempt to close session " + getSessionName()); if (xaProto != null) xaProto.rollbackCurrentTransaction(); server.removeFromSessionTable(session.connNum); try { session.close(); debug(getSessionName() + " closed"); } catch (SQLException se) { debug("encountered exception while closing session " + getSessionName()); sendUnexpectedException(se); close(); } catch (Exception e) { debug("encountered exception while closing session "+ getSessionName()); server.consoleExceptionPrintTrace(e); throw e; } finally { session = null; database = null; appRequester=null; sockis = null; sockos=null; databaseAccessException=null; } }

Target:
private void closeSession() { if (session == null) return; if(LOG.isDebugEnabled()) { LOG.debug(String.format("attempt to close session %s", getSessionName())); } if (xaProto != null) xaProto.rollbackCurrentTransaction(); server.removeFromSessionTable(session.connNum); try { session.close(); if(LOG.isDebugEnabled()) { LOG.debug(String.format("%s closed", getSessionName())); } } catch (SQLException se) { if(LOG.isDebugEnabled()) { LOG.debug(String.format("encountered exception while closing session %s", getSessionName())); } sendUnexpectedException(se); close(); } catch (Exception e) { if(LOG.isDebugEnabled()) { LOG.debug(String.format("encountered exception while closing session %s", getSessionName())); } server.consoleExceptionPrintTrace(e); throw e; } finally { session = null; database = null; appRequester=null; sockis = null; sockos=null; databaseAccessException=null; } }
Source:
public ConnectorTransactionHandle create() { long transactionId = metadata.nextTransactionId(); long commitId = metadata.getCurrentCommitId(); Transaction transaction = new Transaction(metadata, transactionId, commitId); RaptorTransactionHandle handle = new RaptorTransactionHandle(transactionId, commitId); transactions.put(handle, transaction); return handle; }

Target:
public synchronized ConnectorTransactionHandle create() { long transactionId = metadata.nextTransactionId(); long commitId = metadata.getCurrentCommitId(); Transaction transaction = new Transaction(metadata, transactionId, commitId); RaptorTransactionHandle handle = new RaptorTransactionHandle(transactionId, commitId); transactions.put(handle, transaction); return handle; }
Source:
public void testTransformer() { testWorkflow("eu/dnetlib/iis/workflows/transformers/spark/citationmatching/direct/with_sample_data"); }

Target:
public void testTransformer() { testWorkflow("eu/dnetlib/iis/workflows/transformers/spark/citationmatching/direct/test"); }
Source:
private void injectFieldByName(Object arg, Class tgtcls, Class parmcls, String fdname) { try { Pair<Class, String> cachedKey = new Pair<Class, String>(tgtcls, fdname); Field fd = _injectedFieldCache.computeIfAbsent(cachedKey, k -> { try { return Classes.getAnyField(tgtcls, fdname); } catch (NoSuchFieldException e) { } return null; }); if (fd != null) injectField(arg, parmcls, fd); } catch (Exception ex2) { throw UiException.Aide.wrap(ex2); } }

Target:
private void injectFieldByName(Object arg, Class tgtcls, Class parmcls, String fdname) { try { Pair<Class, String> cachedKey = new Pair<Class, String>(tgtcls, fdname); Field fd = _injectedFieldCache.computeIfAbsent(cachedKey, k -> { try { return Classes.getAnyField(tgtcls, fdname); } catch (NoSuchFieldException e) { } return EMPTY_FIELD; }); if (fd != null && !fd.equals(EMPTY_FIELD)) injectField(arg, parmcls, fd); } catch (Exception ex2) { throw UiException.Aide.wrap(ex2); } }
Source:
public static Field saveField(Field oldField) throws DotHibernateException { if (Field.FieldType.HOST_OR_FOLDER.toString().equals(oldField.getFieldType()) || Field.FieldType.LINE_DIVIDER.toString().equals(oldField.getFieldType()) || Field.FieldType.TAB_DIVIDER.toString().equals(oldField.getFieldType()) || Field.FieldType.CATEGORIES_TAB.toString().equals(oldField.getFieldType()) || Field.FieldType.PERMISSIONS_TAB.toString().equals(oldField.getFieldType()) || Field.FieldType.RELATIONSHIPS_TAB.toString().equals(oldField.getFieldType()) || Field.FieldType.CATEGORY.toString().equals(oldField.getFieldType()) || Field.FieldType.TAG.toString().equals(oldField.getFieldType()) || Field.FieldType.HIDDEN.toString().equals(oldField.getFieldType())) { oldField.setFieldContentlet(DataTypes.SYSTEM.toString()); } if(Field.FieldType.HOST_OR_FOLDER.toString().equals(oldField.getFieldType()) || Field.FieldType.TAG.toString().equals(oldField.getFieldType())){ oldField.setIndexed(true); } com.dotcms.contenttype.model.field.Field field = new LegacyFieldTransformer(oldField).from(); try { return new LegacyFieldTransformer( APILocator.getContentTypeFieldAPI().save(field, APILocator.systemUser()) ).asOldField(); } catch (DotDataException | DotSecurityException e) { throw new DotHibernateException(e.getMessage(),e); } }

Target:
public static Field saveField(Field oldField) throws DotHibernateException { final Set<String> systemFieldsSet = set(Field.FieldType.HOST_OR_FOLDER.toString(), Field.FieldType.LINE_DIVIDER.toString(), Field.FieldType.TAB_DIVIDER.toString(), Field.FieldType.CATEGORIES_TAB.toString(), Field.FieldType.PERMISSIONS_TAB.toString(), Field.FieldType.RELATIONSHIPS_TAB.toString(), Field.FieldType.CATEGORY.toString(), Field.FieldType.TAG.toString(), Field.FieldType.HIDDEN.toString()); if (systemFieldsSet.contains(oldField.getFieldType())) { oldField.setFieldContentlet(DataTypes.SYSTEM.toString()); } if(Field.FieldType.HOST_OR_FOLDER.toString().equals(oldField.getFieldType()) || Field.FieldType.TAG.toString().equals(oldField.getFieldType())){ oldField.setIndexed(true); } com.dotcms.contenttype.model.field.Field field = new LegacyFieldTransformer(oldField).from(); try { return new LegacyFieldTransformer( APILocator.getContentTypeFieldAPI().save(field, APILocator.systemUser()) ).asOldField(); } catch (DotDataException | DotSecurityException e) { throw new DotHibernateException(e.getMessage(),e); } }
Source:
private Main() { throw new IllegalStateException("Utility class constructor mustn't be called."); }

Target:
private Main() { }
Source:
public void checkCommandMetadata() throws Exception { try (CommandController controller = uiTestHarness.createCommandController(RestNewEndpointCommandImpl.class, project.getRoot())) { controller.initialize(); assertTrue(controller.getCommand() instanceof RestNewEndpointCommandImpl); assertTrue(controller.getCommand() instanceof AbstractRestNewCommand); UICommandMetadata metadata = controller.getMetadata(); assertEquals("REST: New Endpoint", metadata.getName()); assertEquals("Java EE", metadata.getCategory().getName()); assertEquals("JAX-RS", metadata.getCategory().getSubCategory().getName()); assertEquals(7, controller.getInputs().size()); assertFalse("Project is created, shouldn't have targetLocation", controller.hasInput("targetLocation")); assertTrue(controller.hasInput("named")); assertTrue(controller.hasInput("targetPackage")); assertTrue(controller.hasInput("overwrite")); assertTrue(controller.hasInput("methods")); assertTrue(controller.hasInput("path")); assertTrue(controller.hasInput("extends")); assertTrue(controller.hasInput("implements")); assertTrue(controller.getValueFor("targetPackage").toString().endsWith(DEFAULT_REST_PACKAGE)); } }

Target:
public void checkCommandMetadata() throws Exception { try (CommandController controller = uiTestHarness.createCommandController(RestNewEndpointCommand.class, project.getRoot())) { controller.initialize(); assertTrue(controller.getCommand() instanceof RestNewEndpointCommand); assertTrue(controller.getCommand() instanceof AbstractRestNewCommand); UICommandMetadata metadata = controller.getMetadata(); assertEquals("REST: New Endpoint", metadata.getName()); assertEquals("Java EE", metadata.getCategory().getName()); assertEquals("JAX-RS", metadata.getCategory().getSubCategory().getName()); assertEquals(7, controller.getInputs().size()); assertFalse("Project is created, shouldn't have targetLocation", controller.hasInput("targetLocation")); assertTrue(controller.hasInput("named")); assertTrue(controller.hasInput("targetPackage")); assertTrue(controller.hasInput("overwrite")); assertTrue(controller.hasInput("methods")); assertTrue(controller.hasInput("path")); assertTrue(controller.hasInput("extends")); assertTrue(controller.hasInput("implements")); assertTrue(controller.getValueFor("targetPackage").toString().endsWith(DEFAULT_REST_PACKAGE)); } }
Source:
private ResendConfirmationCodeResult resendConfirmationCodeInternal(final Map<String, String> clientMetadata) { final ResendConfirmationCodeRequest resendConfirmationCodeRequest = new ResendConfirmationCodeRequest() .withUsername(userId) .withClientId(clientId) .withSecretHash(secretHash); final String pinpointEndpointId = pool.getPinpointEndpointId(); resendConfirmationCodeRequest.setUserContextData(getUserContextData()); if (pinpointEndpointId != null) { AnalyticsMetadataType amd = new AnalyticsMetadataType(); amd.setAnalyticsEndpointId(pinpointEndpointId); resendConfirmationCodeRequest.setAnalyticsMetadata(amd); } return cognitoIdentityProviderClient.resendConfirmationCode(resendConfirmationCodeRequest); }

Target:
private ResendConfirmationCodeResult resendConfirmationCodeInternal(final Map<String, String> clientMetadata) { final ResendConfirmationCodeRequest resendConfirmationCodeRequest = new ResendConfirmationCodeRequest() .withUsername(userId) .withClientId(clientId) .withSecretHash(secretHash) .withClientMetadata(clientMetadata); final String pinpointEndpointId = pool.getPinpointEndpointId(); resendConfirmationCodeRequest.setUserContextData(getUserContextData()); if (pinpointEndpointId != null) { AnalyticsMetadataType amd = new AnalyticsMetadataType(); amd.setAnalyticsEndpointId(pinpointEndpointId); resendConfirmationCodeRequest.setAnalyticsMetadata(amd); } return cognitoIdentityProviderClient.resendConfirmationCode(resendConfirmationCodeRequest); }
Source:
public void addFilteredExecution(Long activityId) { TaskActivity activity = taskActivitiesDataService.findById(activityId); if (activity == null) { return; } TaskExecutionProgress progress = activity.getTaskExecutionProgress(); progress.addActionFiltered(); updateTaskProgress(progress, activity); }

Target:
public void addFilteredExecution(Long activityId) { TaskActivity activity = taskActivitiesDataService.findById(activityId); if (activity != null) { TaskExecutionProgress progress = activity.getTaskExecutionProgress(); progress.addActionFiltered(); updateTaskProgress(progress, activity); } }
Source:
public void setUp() throws Exception { conf = SCMTestUtils.getConf(); conf.setTimeDuration(OZONE_SCM_HEARTBEAT_RPC_TIMEOUT, 500, TimeUnit.MILLISECONDS); conf.setBoolean(OzoneConfigKeys.DFS_CONTAINER_RATIS_IPC_RANDOM_PORT, true); conf.setBoolean(OzoneConfigKeys.DFS_CONTAINER_IPC_RANDOM_PORT, true); serverAddresses = new ArrayList<>(); scmServers = new ArrayList<>(); mockServers = new ArrayList<>(); for (int x = 0; x < scmServerCount; x++) { int port = SCMTestUtils.getReuseableAddress().getPort(); String address = "127.0.0.1"; serverAddresses.add(address + ":" + port); ScmTestMock mock = new ScmTestMock(); scmServers.add(SCMTestUtils.startScmRpcServer(conf, mock, new InetSocketAddress(address, port), 10)); mockServers.add(mock); } conf.setStrings(ScmConfigKeys.OZONE_SCM_NAMES, serverAddresses.toArray(new String[0])); String path = GenericTestUtils .getTempPath(TestDatanodeStateMachine.class.getSimpleName()); testRoot = new File(path); if (!testRoot.mkdirs()) { LOG.info("Required directories already exist.", testRoot); } File dataDir = new File(testRoot, "data"); conf.set(HDDS_DATANODE_DIR_KEY, dataDir.getAbsolutePath()); if (!dataDir.mkdirs()) { LOG.info("Data dir create failed."); } conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, new File(testRoot, "scm").getAbsolutePath()); path = new File(testRoot, "datnodeID").getAbsolutePath(); conf.set(ScmConfigKeys.OZONE_SCM_DATANODE_ID, path); executorService = HadoopExecutors.newCachedThreadPool( new ThreadFactoryBuilder().setDaemon(true) .setNameFormat("Test Data Node State Machine Thread - %d").build()); }

Target:
public void setUp() throws Exception { conf = SCMTestUtils.getConf(); conf.setTimeDuration(OZONE_SCM_HEARTBEAT_RPC_TIMEOUT, 500, TimeUnit.MILLISECONDS); conf.setBoolean(OzoneConfigKeys.DFS_CONTAINER_RATIS_IPC_RANDOM_PORT, true); conf.setBoolean(OzoneConfigKeys.DFS_CONTAINER_IPC_RANDOM_PORT, true); serverAddresses = new ArrayList<>(); scmServers = new ArrayList<>(); mockServers = new ArrayList<>(); for (int x = 0; x < scmServerCount; x++) { int port = SCMTestUtils.getReuseableAddress().getPort(); String address = "127.0.0.1"; serverAddresses.add(address + ":" + port); ScmTestMock mock = new ScmTestMock(); scmServers.add(SCMTestUtils.startScmRpcServer(conf, mock, new InetSocketAddress(address, port), 10)); mockServers.add(mock); } conf.setStrings(ScmConfigKeys.OZONE_SCM_NAMES, serverAddresses.toArray(new String[0])); String path = GenericTestUtils .getTempPath(TestDatanodeStateMachine.class.getSimpleName()); testRoot = new File(path); if (!testRoot.mkdirs()) { LOG.info("Required directories already exist.", testRoot); } File dataDir = new File(testRoot, "data"); conf.set(HDDS_DATANODE_DIR_KEY, dataDir.getAbsolutePath()); if (!dataDir.mkdirs()) { LOG.info("Data dir create failed."); } conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, new File(testRoot, "scm").getAbsolutePath()); path = new File(testRoot, "datanodeID").getAbsolutePath(); conf.set(ScmConfigKeys.OZONE_SCM_DATANODE_ID_DIR, path); executorService = HadoopExecutors.newCachedThreadPool( new ThreadFactoryBuilder().setDaemon(true) .setNameFormat("Test Data Node State Machine Thread - %d").build()); }
Source:
public long getTokenExpiration(String tokenId, boolean validate) throws UnknownTokenException { if (validate) { validateToken(tokenId); } long expiration = 0; try { expiration = super.getTokenExpiration(tokenId, validate); return expiration; } catch (UnknownTokenException e) { } try { char[] expStr = aliasService.getPasswordFromAliasForCluster(AliasService.NO_CLUSTER_NAME, tokenId); if (expStr != null) { expiration = Long.parseLong(new String(expStr)); super.updateExpiration(tokenId, expiration); } } catch (Exception e) { log.errorAccessingTokenState(tokenId, e); } return expiration; }

Target:
public long getTokenExpiration(String tokenId, boolean validate) throws UnknownTokenException { try { return super.getTokenExpiration(tokenId, validate); } catch (UnknownTokenException e) { } if (validate) { validateToken(tokenId); } long expiration = 0; try { char[] expStr = aliasService.getPasswordFromAliasForCluster(AliasService.NO_CLUSTER_NAME, tokenId); if (expStr != null) { expiration = Long.parseLong(new String(expStr)); super.updateExpiration(tokenId, expiration); } } catch (Exception e) { log.errorAccessingTokenState(tokenId, e); } return expiration; }
Source:
public ResponseEntity<?> getStorage(@PathVariable("id") final String id, final NativeWebRequest request) { if (!adminService.isAdmin(AuthorizationService.Operation.READ)) { return status(FORBIDDEN).build(); } final Storage storage = storageService.getStorage(id); return status(OK).body(storage); }

Target:
public ResponseEntity<?> getStorage(@PathVariable("id") final String id, final NativeWebRequest request) throws PluginException, NoSuchStorageException, InternalNakadiException { if (!adminService.isAdmin(AuthorizationService.Operation.READ)) { return status(FORBIDDEN).build(); } final Storage storage = storageService.getStorage(id); return status(OK).body(storage); }
Source:
Class<?> getASMClass() throws ClassNotFoundException; String getMethodSignature(Method m); String getNonPrimitive(Class<?> tp); String getPrimitive(Class<?> tp); void setBadASM(boolean b); public interface ASMType { int getOpcode(int ireturn); }

Target:
Class<?> getASMClass() throws ClassNotFoundException; String getMethodSignature(Method m); String getNonPrimitive(Class<?> tp); String getPrimitive(Class<?> tp); public interface ASMType { int getOpcode(int ireturn); }
Source:
private static Range<LocalDate> getDateRangeFromLookupFields(String lookupFields, String dateName) { DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); LocalDate min = new LocalDate(); LocalDate max = new LocalDate(); Map<String, String> rangeMap = (Map < String, String>)getObjectFromLookupFields(lookupFields, dateName); if (!StringUtils.isEmpty(rangeMap.get("min"))) { min = formatter.parseLocalDate(rangeMap.get("min")); } if (!StringUtils.isEmpty(rangeMap.get("max"))) { max = formatter.parseLocalDate(rangeMap.get("max")); } if(max != null && min != null && max.isBefore(min)) { return null; } return new Range<>(min, max); }

Target:
private static Range<LocalDate> getDateRangeFromLookupFields(String lookupFields, String dateName) { DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); LocalDate min = null; LocalDate max = null; Map<String, String> rangeMap = (Map < String, String>)getObjectFromLookupFields(lookupFields, dateName); if (StringUtils.isNotBlank(rangeMap.get("min"))) { min = formatter.parseLocalDate(rangeMap.get("min")); } if (StringUtils.isNotBlank(rangeMap.get("max"))) { max = formatter.parseLocalDate(rangeMap.get("max")); } if(max != null && min != null && max.isBefore(min)) { return null; } return new Range<>(min, max); }
Source:
private synchronized PackIndex idx() throws IOException { if (loadedIdx == null) { if (invalid) throw new PackInvalidException(packFile); try { final PackIndex idx = PackIndex.open(extFile(INDEX)); if (packChecksum == null) { packChecksum = idx.packChecksum; } else if (!Arrays.equals(packChecksum, idx.packChecksum)) { throw new PackMismatchException(MessageFormat.format( JGitText.get().packChecksumMismatch, packFile.getPath())); } loadedIdx = idx; } catch (InterruptedIOException e) { throw e; } catch (IOException e) { invalid = true; throw e; } } return loadedIdx; }

Target:
private synchronized PackIndex idx() throws IOException { if (loadedIdx == null) { if (invalid) throw new PackInvalidException(packFile); try { final PackIndex idx = PackIndex.open(extFile(INDEX)); if (packChecksum == null) { packChecksum = idx.packChecksum; } else if (!Arrays.equals(packChecksum, idx.packChecksum)) { throw new PackMismatchException(MessageFormat.format( JGitText.get().packChecksumMismatch, packFile.getPath(), packChecksum, idx.packChecksum)); } loadedIdx = idx; } catch (InterruptedIOException e) { throw e; } catch (IOException e) { invalid = true; throw e; } } return loadedIdx; }
Source:
protected void executeQueryCommand() { List<OvfEntityData> entityList = getOvfEntityList(); List<VmTemplate> vmTemplates = new ArrayList<>(); OvfHelper ovfHelper = getOvfHelper(); for (OvfEntityData ovf : entityList) { VmTemplate vmTemplate = null; try { vmTemplate = ovfHelper.readVmTemplateFromOvf(ovf.getOvfData()); vmTemplates.add(vmTemplate); } catch (OvfReaderException e) { log.debug("failed to parse a given ovf configuration: \n" + ovf.getOvfData(), e); getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); } } getQueryReturnValue().setSucceeded(true); getQueryReturnValue().setReturnValue(vmTemplates); }

Target:
protected void executeQueryCommand() { List<OvfEntityData> entityList = getOvfEntityList(VmEntityType.TEMPLATE); List<VmTemplate> vmTemplates = new ArrayList<>(); OvfHelper ovfHelper = getOvfHelper(); for (OvfEntityData ovf : entityList) { try { vmTemplates.add(ovfHelper.readVmTemplateFromOvf(ovf.getOvfData())); } catch (OvfReaderException e) { log.debug("failed to parse a given ovf configuration: \n" + ovf.getOvfData(), e); getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); } } getQueryReturnValue().setSucceeded(true); getQueryReturnValue().setReturnValue(vmTemplates); }
Source:
protected Set<View> getViewsAccordingToGeneralization(final Generalization generalization) { Set<View> viewsToDestroy = new HashSet<View>(); final Classifier general = generalization.getGeneral(); if (general != null) { final EList<NamedElement> members = general.getMembers(); for (final NamedElement member : members) { final Iterator<View> viewIt = CrossReferencerUtil.getCrossReferencingViews(member, null).iterator(); while (viewIt.hasNext()) { final View view = viewIt.next(); final GeneralizationUtil util = new GeneralizationUtil(); if (util.isConcernedByGeneralizationChanges(generalization, view)) { viewsToDestroy.add(view); } } } } return viewsToDestroy; }

Target:
protected Set<View> getViewsAccordingToGeneralization(final Generalization generalization) { Set<View> viewsToDestroy = new HashSet<View>(); final Classifier general = generalization.getGeneral(); if (null != general) { final EList<NamedElement> members = general.getMembers(); for (final NamedElement member : members) { final Iterator<View> viewIt = CrossReferencerUtil.getCrossReferencingViews(member, null).iterator(); while (viewIt.hasNext()) { final View view = viewIt.next(); final GeneralizationUtil util = new GeneralizationUtil(); if (util.isConcernedByGeneralizationChanges(generalization, view)) { viewsToDestroy.add(view); } } } } return viewsToDestroy; }
Source:
public GroupByStrategy strategize(GroupByQuery query) { final String strategyString = query.getContextValue(CTX_KEY_STRATEGY, config.getDefaultStrategy()); switch (strategyString) { case STRATEGY_EPINEPHELINAE: return epi; case STRATEGY_OLD_FAITHFUL: return oldFaithful; default: throw new ISE("No such strategy[%s]", strategyString); } }

Target:
public GroupByStrategy strategize(GroupByQuery query) { final String strategyString = query.getContextValue(CTX_KEY_STRATEGY, config.getDefaultStrategy()); switch (strategyString) { case STRATEGY_V2: return strategyV2; case STRATEGY_V1: return strategyV1; default: throw new ISE("No such strategy[%s]", strategyString); } }
Source:
public static Block toMap(MapType mapType, BlockBuilderAppender keyAppender, BlockBuilderAppender valueAppender, ConnectorSession connectorSession, Slice json) { try (JsonParser jsonParser = createJsonParser(JSON_FACTORY, json)) { BlockBuilder mapBlockBuilder = mapType.createBlockBuilder(new BlockBuilderStatus(), 1); BlockBuilder singleMapBlockBuilder = mapBlockBuilder.beginBlockEntry(); jsonParser.nextToken(); if (jsonParser.getCurrentToken() == JsonToken.VALUE_NULL) { return null; } checkState(jsonParser.currentToken() == JsonToken.START_OBJECT, "Expected a json object"); int position = 0; HashTable hashTable = new HashTable(mapType.getKeyType()); while (jsonParser.nextValue() != JsonToken.END_OBJECT) { keyAppender.append(jsonParser, singleMapBlockBuilder); valueAppender.append(jsonParser, singleMapBlockBuilder); if (hashTable.contains(singleMapBlockBuilder, position)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Duplicate keys are not allowed"); } hashTable.add(singleMapBlockBuilder, position); position += 2; } mapBlockBuilder.closeEntry(); return mapType.getObject(mapBlockBuilder, mapBlockBuilder.getPositionCount() - 1); } catch (RuntimeException e) { throw new PrestoException(INVALID_CAST_ARGUMENT, format("Value %s cannot be cast to %s", json.toStringUtf8(), mapType), e); } catch (IOException e) { throw Throwables.propagate(e); } }

Target:
public static Block toMap(MapType mapType, BlockBuilderAppender keyAppender, BlockBuilderAppender valueAppender, ConnectorSession connectorSession, Slice json) { try (JsonParser jsonParser = createJsonParser(JSON_FACTORY, json)) { jsonParser.nextToken(); if (jsonParser.getCurrentToken() == JsonToken.VALUE_NULL) { return null; } if (jsonParser.getCurrentToken() != START_OBJECT) { throw new JsonCastException(format("Expected a json object, but got %s", jsonParser.getText())); } BlockBuilder mapBlockBuilder = mapType.createBlockBuilder(new BlockBuilderStatus(), 1); BlockBuilder singleMapBlockBuilder = mapBlockBuilder.beginBlockEntry(); HashTable hashTable = new HashTable(mapType.getKeyType(), singleMapBlockBuilder); int position = 0; while (jsonParser.nextToken() != JsonToken.END_OBJECT) { keyAppender.append(jsonParser, singleMapBlockBuilder); jsonParser.nextToken(); valueAppender.append(jsonParser, singleMapBlockBuilder); if (!hashTable.addIfAbsent(position)) { throw new JsonCastException("Duplicate keys are not allowed"); } position += 2; } if (jsonParser.nextToken() != null) { throw new JsonCastException(format("Unexpected trailing token: %s", jsonParser.getText())); } mapBlockBuilder.closeEntry(); return mapType.getObject(mapBlockBuilder, mapBlockBuilder.getPositionCount() - 1); } catch (PrestoException | JsonCastException e) { throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast to %s. %s\n%s", mapType, e.getMessage(), truncateIfNecessaryForErrorMessage(json)), e); } catch (Exception e) { throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast to %s.\n%s", mapType, truncateIfNecessaryForErrorMessage(json)), e); } }
Source:
public String getSecureMessage() { final String userName = Optional.ofNullable(securityContext.getUser()). map(u -> u.getName()). orElse("UNNOWN"); LOG.info("Secure endpoint called by {}", userName); return "A secure message that was requested by " + userName; }

Target:
public String getSecureMessage() { final String userName = Optional.ofNullable(securityContext.getUser()). map(u -> u.getName()). orElse("UNKNOWN"); LOG.info("Secure endpoint called by {}", userName); return "A secure message that was requested by " + userName; }
Source:
private IAction createClampAction() { Action action = new Action(Messages.TmfChartView_ClampYAxis, IAction.AS_PUSH_BUTTON) { @Override public void run() { super.run(); LockRangeDialog rangeDialog = new LockRangeDialog(getSite().getShell(), getChartViewer()); rangeDialog.open(); } }; action.setChecked(false); return action; }

Target:
private IAction createClampAction() { Action action = new Action(Messages.TmfChartView_LockYAxis, IAction.AS_PUSH_BUTTON) { @Override public void run() { super.run(); LockRangeDialog rangeDialog = new LockRangeDialog(getSite().getShell(), getChartViewer()); rangeDialog.open(); } }; action.setChecked(false); return action; }
Source:
public void testCheckAttributeReturnNull() throws Exception { System.out.println("testCheckAttriubuteReturnNull()"); attributeToCheck.setValue(null); classInstance.checkAttributeSyntax(session, new Member(), new Group(), attributeToCheck); }

Target:
public void testCheckAttributeReturnNull() throws Exception { System.out.println("testCheckAttributeReturnNull()"); attributeToCheck.setValue(null); classInstance.checkAttributeSyntax(session, new Member(), new Group(), attributeToCheck); }
Source:
protected String computeMetricName(Message<?> message) { String counterName = nameExpression.getValue(evaluationContext, message, CharSequence.class).toString(); return counterName; }

Target:
protected String computeMetricName(Message<?> message) { return nameExpression.getValue(evaluationContext, message, CharSequence.class).toString(); }
Source:
private static Optional<IntegerStatistics> mergeIntegerStatistics(Optional<IntegerStatistics> first, Optional<IntegerStatistics> second) { if (first.isPresent() && second.isPresent()) { return Optional.of(new IntegerStatistics( reduce(first.get().getMin(), second.get().getMin(), SELECT_MIN, true), reduce(first.get().getMax(), second.get().getMax(), SELECT_MAX, true))); } return Optional.empty(); }

Target:
private static Optional<IntegerStatistics> mergeIntegerStatistics(Optional<IntegerStatistics> first, Optional<IntegerStatistics> second) { if (first.isPresent() && second.isPresent()) { return Optional.of(new IntegerStatistics( reduce(first.get().getMin(), second.get().getMin(), MIN, true), reduce(first.get().getMax(), second.get().getMax(), MAX, true))); } return Optional.empty(); }
Source:
public String putBlob(BlobProperties blobProperties, ByteBuffer userMetadata, InputStream blobStream) throws CoordinatorException { PartitionId partitionId = getPartitionForPut(); BlobId blobId = new BlobId(partitionId); OperationContext oc = getOperationContext(); PutOperation putOperation = new PutOperation(datacenterName, connectionPool, requesterPool, oc, blobId, operationTimeoutMs, blobProperties, userMetadata, blobStream, (short) 1, (short) 1); putOperation.execute(); notificationSystem.onBlobCreated(blobId.getID(), blobProperties, userMetadata.array()); return blobId.getID(); }

Target:
public String putBlob(BlobProperties blobProperties, ByteBuffer userMetadata, InputStream blobStream) throws CoordinatorException { PartitionId partitionId = getPartitionForPut(); BlobId blobId = new BlobId(partitionId); OperationContext oc = getOperationContext(); PutOperation putOperation = new PutOperation(datacenterName, connectionPool, requesterPool, oc, blobId, operationTimeoutMs, blobProperties, userMetadata, blobStream, 1, 1); putOperation.execute(); notificationSystem.onBlobCreated(blobId.getID(), blobProperties, userMetadata.array()); return blobId.getID(); }
Source:
protected void onSetSSLParameters(SSLParameters sslParameters) { if (endpointIdentificationAlgorithm == null) { super.onSetSSLParameters(sslParameters); } else { sslParameters.setEndpointIdentificationAlgorithm(endpointIdentificationAlgorithm); } }

Target:
protected void onSetSSLParameters(SSLParameters sslParameters) { if (endpointIdentificationAlgorithm != null) { sslParameters.setEndpointIdentificationAlgorithm(endpointIdentificationAlgorithm); } }
Source:
public static void main(String[] args) throws FlinkException { checkArgument(args.length > 0, "Command not specified."); Command command = Command.valueOf(args[0]); String[] commandArgs = Arrays.copyOfRange(args, 1, args.length); Configuration configuration = FlinkConfigLoader.loadConfiguration(commandArgs); List<String> output = runCommand(command, configuration); for (String outputLine : output) { System.out.println(EXECUTION_PREFIX + outputLine); } }

Target:
public static void main(String[] args) throws FlinkException { checkArgument(args.length > 0, "Command not specified."); Command command = Command.valueOf(args[0]); String[] commandArgs = Arrays.copyOfRange(args, 1, args.length); List<String> output = runCommand(command, commandArgs); for (String outputLine : output) { System.out.println(EXECUTION_PREFIX + outputLine); } }
Source:
public <I extends T> RegistryObject<I> register(final String name, final Supplier<? extends I> sup) { Objects.requireNonNull(name); Objects.requireNonNull(sup); final ResourceLocation key = new ResourceLocation(modid, name); RegistryObject<I> ret; try { ret = RegistryObject.of(key, this.type); } catch (IllegalArgumentException e) { LOGGER.error("Errored while trying to register an entry. This likely happened due to registering for a custom registry, use lazyRegister instead."); throw new IllegalArgumentException("Null registry used in DeferredRegister"); } if (entries.putIfAbsent((RegistryObject<T>) ret, () -> sup.get().setRegistryName(key)) != null) { throw new IllegalArgumentException("Duplicate registration " + name); } return ret; }

Target:
public <I extends T> RegistryObject<I> register(final String name, final Supplier<? extends I> sup) { Objects.requireNonNull(name); Objects.requireNonNull(sup); final ResourceLocation key = new ResourceLocation(modid, name); if(this.type == null) { LOGGER.error("Errored while trying to register an entry. This likely happened due to registering for a custom registry, use lazyRegister instead."); throw new IllegalArgumentException("Null registry used in DeferredRegister"); } RegistryObject<I> ret = RegistryObject.of(key, this.type); if (entries.putIfAbsent((RegistryObject<T>) ret, () -> sup.get().setRegistryName(key)) != null) { throw new IllegalArgumentException("Duplicate registration " + name); } return ret; }
Source:
public void checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine sslEngine) throws CertificateException { if (delegate instanceof X509ExtendedTrustManager) { ((X509ExtendedTrustManager)delegate).checkClientTrusted(chain, authType, sslEngine); } else { throw new UnsupportedOperationException(); } verifier.checkChain(chain); }

Target:
public void checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine sslEngine) throws CertificateException { if (delegate instanceof X509ExtendedTrustManager) { ((X509ExtendedTrustManager)delegate).checkServerTrusted(chain, authType, sslEngine); } else { throw new UnsupportedOperationException(); } verifier.checkChain(chain); }
Source:
public Genotype makeWithShallowCopy() { final Map<String, Object> ea = (extendedAttributes == null) ? NO_ATTRIBUTES : new HashMap<>(extendedAttributes); final List<Allele> al = new ArrayList<>(alleles); final int[] copyAD = (AD == null) ? null : Arrays.copyOf(AD, AD.length); final int[] copyPL = (AD == null) ? null : Arrays.copyOf(PL, PL.length); return new FastGenotype(sampleName, al, isPhased, GQ, DP, copyAD, copyPL, filters, ea); }

Target:
public Genotype makeWithShallowCopy() { final Map<String, Object> ea = (extendedAttributes == null) ? NO_ATTRIBUTES : new HashMap<>(extendedAttributes); final List<Allele> al = new ArrayList<>(alleles); final int[] copyAD = (AD == null) ? null : Arrays.copyOf(AD, AD.length); final int[] copyPL = (PL == null) ? null : Arrays.copyOf(PL, PL.length); return new FastGenotype(sampleName, al, isPhased, GQ, DP, copyAD, copyPL, filters, ea); }
Source:
public void start() { try { LOGGER.log(Level.INFO, "Starting rest server"); webManager.start(); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Error occurred when starting rest server", e); throw new VXQueryRuntimeException("Unable to start REST server", e); } LOGGER.log(Level.INFO, "Rest server started"); }

Target:
public void start() { try { LOGGER.log(Level.FINE, "Starting rest server on port: " + port); webManager.start(); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Error occurred when starting rest server", e); throw new VXQueryRuntimeException("Unable to start REST server", e); } LOGGER.log(Level.INFO, "Rest server started on port: " + port); }
Source:
public void validateSpecifications(@NonNull JSONObject specifications, Options options, @NonNull final ResponseListener<Boolean> listener) throws JSONException { if (specifications == null) { throw new IllegalArgumentException("Collection.validateSpecifications: specifications cannot be null"); } JSONObject data = new JSONObject() .put("body", new JSONObject() .put(this.getIndex(), new JSONObject() .put(this.getCollection(), specifications) ) ); try { this.kuzzle.addHeaders(data, this.getHeaders()); this.kuzzle.query(makeQueryArgs("collection", "validateSpecifications"), data, options, new OnQueryDoneListener() { @Override public void onSuccess(JSONObject response) { try { listener.onSuccess(response.getJSONObject("result").getBoolean("valid")); } catch (JSONException e) { throw new RuntimeException(e); } } @Override public void onError(JSONObject error) { listener.onError(error); } }); } catch (JSONException e) { throw new RuntimeException(e); } }

Target:
public void validateSpecifications(@NonNull JSONObject specifications, Options options, @NonNull final ResponseListener<Boolean> listener) throws JSONException { if (specifications == null) { throw new IllegalArgumentException("Collection.validateSpecifications: specifications cannot be null"); } if (listener == null) { throw new IllegalArgumentException("listener cannot be null"); } JSONObject data = new JSONObject() .put("body", new JSONObject() .put(this.getIndex(), new JSONObject() .put(this.getCollection(), specifications) ) ); try { this.kuzzle.addHeaders(data, this.getHeaders()); this.kuzzle.query(makeQueryArgs("collection", "validateSpecifications"), data, options, new OnQueryDoneListener() { @Override public void onSuccess(JSONObject response) { try { listener.onSuccess(response.getJSONObject("result").getBoolean("valid")); } catch (JSONException e) { throw new RuntimeException(e); } } @Override public void onError(JSONObject error) { listener.onError(error); } }); } catch (JSONException e) { throw new RuntimeException(e); } }
Source:
private void showLightStyle() { final TextView titleView = (TextView) mInAppView.findViewById(R.id.com_mixpanel_android_notification_title); final ImageView notifImage = (ImageView) mInAppView.findViewById(R.id.com_mixpanel_android_notification_image); GradientDrawable viewBackground = new GradientDrawable(); viewBackground.setColor(0xFFFFFFFF); viewBackground.setStroke(2, Color.rgb(218, 223, 232)); viewBackground.setCornerRadius(6); if(Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { mInAppView.setBackgroundDrawable(viewBackground); } else { mInAppView.setBackground(viewBackground); } titleView.setTextColor(Color.rgb(123, 146, 163)); Drawable myIcon = new BitmapDrawable(getResources(), mDisplayState.getInAppNotification().getImage()); final int newColor = Color.rgb(123, 146, 163); myIcon.setColorFilter(newColor, PorterDuff.Mode.SRC_ATOP); notifImage.setImageDrawable(myIcon); }

Target:
private void showLightStyle() { final TextView titleView = (TextView) mInAppView.findViewById(R.id.com_mixpanel_android_notification_title); final ImageView notifImage = (ImageView) mInAppView.findViewById(R.id.com_mixpanel_android_notification_image); GradientDrawable viewBackground = new GradientDrawable(); viewBackground.setColor(Color.WHITE); viewBackground.setCornerRadius(6); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { viewBackground.setStroke(2, getResources().getColor(R.color.com_mixpanel_android_inapp_light_softgray)); titleView.setTextColor(getResources().getColor(R.color.com_mixpanel_android_inapp_light_gray)); } else { viewBackground.setStroke(2, getResources().getColor(R.color.com_mixpanel_android_inapp_light_softgray, null)); titleView.setTextColor(getResources().getColor(R.color.com_mixpanel_android_inapp_light_gray, null)); } if(Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { mInAppView.setBackgroundDrawable(viewBackground); } else { mInAppView.setBackground(viewBackground); } Drawable myIcon = new BitmapDrawable(getResources(), mDisplayState.getInAppNotification().getImage()); final int newColor; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { newColor = getResources().getColor(R.color.com_mixpanel_android_inapp_light_gray); } else { newColor = getResources().getColor(R.color.com_mixpanel_android_inapp_light_gray, null); } myIcon.setColorFilter(newColor, PorterDuff.Mode.SRC_ATOP); notifImage.setImageDrawable(myIcon); }
Source:
public Project getProject(String name) { Project fetchedProject = null; try { fetchedProject = projectLoader.fetchProjectByName(name); loadAllProjectFlows(fetchedProject); } catch (ProjectManagerException e) { logger.error("Could not load project from store.", e); } return fetchedProject; }

Target:
public Project getProject(String name) { Project fetchedProject = null; try { fetchedProject = projectLoader.fetchProjectByName(name); loadAllProjectFlows(fetchedProject); } catch (ProjectManagerException e) { logger.error("Could not load project" + name + " from store.", e); } return fetchedProject; }
Source:
public void doesNotLoadLeaderPaxosAsNamespace() { Set<String> namespaces = diskNamespaceLoader.getAllPersistedNamespaces().stream().map(client -> client.value()).collect( Collectors.toSet()); assertThat(namespaces).containsExactlyInAnyOrder(NAMESPACE_1, NAMESPACE_2); }

Target:
public void doesNotLoadLeaderPaxosAsNamespace() { Set<String> namespaces = diskNamespaceLoader.getAllPersistedNamespaces().stream().map(Client::value).collect( Collectors.toSet()); assertThat(namespaces).containsExactlyInAnyOrder(NAMESPACE_1, NAMESPACE_2); }
Source:
public ViewPage createPageWithAttachment(EntityReference reference, String content, String title, String attachmentName, InputStream attachmentData) throws Exception { ViewPage vp = createPage(reference, content, title); attachFile(reference, attachmentName, attachmentData, false); return vp; }

Target:
public ViewPage createPageWithAttachment(EntityReference reference, String content, String title, String attachmentName, InputStream attachmentData) throws Exception { return createPageWithAttachment(reference, content, title, attachmentName, attachmentData, null); }
Source:
protected boolean uploadSegment(File segmentTarFile, SegmentUploader segmentUploader, SegmentCompletionProtocol.Request.Params params) { URI segmentLocation = segmentUploader.uploadSegment(segmentTarFile, new LLCSegmentName(params.getSegmentName())); if (segmentLocation != null) { params.withSegmentLocation(segmentLocation.toString()); } else { params.withSegmentLocation("peer:/ } return true; }

Target:
protected String uploadSegment(File segmentTarFile, SegmentUploader segmentUploader, SegmentCompletionProtocol.Request.Params params) { URI segmentLocation = segmentUploader.uploadSegment(segmentTarFile, new LLCSegmentName(params.getSegmentName())); if (segmentLocation == null) { return StringUtil.join("/", CommonConstants.Segment.PEER_SEGMENT_DOWNLOAD_SCHEME, params.getSegmentName()); } return segmentLocation.toString(); }
Source:
private VBox createMatchingMilestonesBox() { VBox milestoneGroup = new VBox(); milestoneGroup.setPrefHeight(30 * MilestonePickerState.BEST_MATCHING_LIMIT); milestoneGroup.setStyle("-fx-border-radius: 3;-fx-background-color: white;-fx-border-color: black;"); return milestoneGroup; }

Target:
private VBox createMatchingMilestonesBox() { VBox milestoneGroup = new VBox(); milestoneGroup.setPrefHeight(DETAILED_MILESTONE_HEIGHT * MilestonePickerState.BEST_MATCHING_LIMIT); milestoneGroup.setStyle("-fx-border-radius: 3;-fx-background-color: white;-fx-border-color: black;"); return milestoneGroup; }
Source:
public void execute(AbstractBuild<?, ?> build) throws DockerException, IOException { DockerClient client = getClient(build); String xImage = expand(build, image); String xCommand = expand(build, dockerCommand); String xHostname = expand(build, hostname); LOGGER.info("Pulling image " + xImage); final StringBuilder resultBuilder = new StringBuilder(); PullImageResultCallback resultCallback = new PullImageResultCallback() { public void onNext(PullResponseItem item) { if (item.getStatus() != null && item.getProgress() == null) { resultBuilder.append("\n").append(item.getId()).append(":").append(item.getStatus()); } super.onNext(item); } }; client.pullImageCmd(xImage).exec(resultCallback).awaitSuccess(); String strResult = resultBuilder.toString(); LOGGER.log(Level.INFO, "Pull result = {0}", strResult); LOGGER.log(Level.INFO, "Starting container for image {0}", xImage); DockerTemplateBase template = new DockerSimpleTemplate(xImage, dnsString, xCommand, volumesString, volumesFrom, environmentsString, lxcConfString, xHostname, memoryLimit, cpuShares, bindPorts, bindAllPorts, privileged, tty, macAddress); String containerId = DockerCloud.runContainer(template, client, null); LOGGER.log(Level.INFO, "Started container {0}", containerId); getLaunchAction(build).started(client, containerId); }

Target:
public void execute(AbstractBuild<?, ?> build) throws DockerException, IOException { DockerClient client = getClient(build); String xImage = expand(build, image); String xCommand = expand(build, dockerCommand); String xHostname = expand(build, hostname); LOGGER.info("Pulling image " + xImage); PullImageResultCallback resultCallback = new PullImageResultCallback() { public void onNext(PullResponseItem item) { if (item.getStatus() != null && item.getProgress() == null) { LOGGER.info(item.getId() + ":" + item.getStatus()); } super.onNext(item); } }; client.pullImageCmd(xImage).exec(resultCallback).awaitSuccess(); LOGGER.log(Level.INFO, "Starting container for image {0}", xImage); DockerTemplateBase template = new DockerSimpleTemplate(xImage, dnsString, xCommand, volumesString, volumesFrom, environmentsString, lxcConfString, xHostname, memoryLimit, cpuShares, bindPorts, bindAllPorts, privileged, tty, macAddress); String containerId = DockerCloud.runContainer(template, client, null); LOGGER.log(Level.INFO, "Started container {0}", containerId); getLaunchAction(build).started(client, containerId); }