auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Map<Guid, List<VM>> mapHaVmToHostByCluster(Guid clusterId) { List<VM> vms = DbFacade.getInstance().getVmDao().getAllForVdsGroup(clusterId); if (vms == null) { return Collections.EMPTY_MAP; } vms = LinqUtils.filter(vms, new Predicate<VM>() { @Override public boolean eval(VM v) { return v.isAutoStartup(); } }); return HaReservationHandling.mapVmToHost(vms); }

Target:
public static Map<Guid, List<VM>> mapHaVmToHostByCluster(Guid clusterId) { List<VM> vms = DbFacade.getInstance().getVmDao().getAllForVdsGroup(clusterId); if (vms == null || vms.isEmpty()) { return Collections.EMPTY_MAP; } vms = LinqUtils.filter(vms, new Predicate<VM>() { @Override public boolean eval(VM v) { return v.isAutoStartup(); } }); return mapVmToHost(vms); }
Source:
public BoxRequestsMetadata.DeleteFileMetadata getDeleteMetadataTemplateRequest(String id, String template) { BoxRequestsMetadata.DeleteFileMetadata request = new BoxRequestsMetadata.DeleteFileMetadata(getFileMetadataUrl(id, template), mSession); return request; }

Target:
public BoxRequestsMetadata.DeleteFileMetadata getDeleteMetadataTemplateRequest(String id, String template) { return getDeleteFileMetadataTemplateRequest(id, template); }
Source:
public String toString() { final int resultSize = computeLength(); if (resultSize <= 0) { return StringUtils.EMPTY; } char[] result = new char[resultSize]; int offset = 0; if ((separators & HAS_LEADING) != 0) { result[offset++] = SEPARATOR; } final int len = segments.length - 1; if (len >= 0) { for (int i = 0; i < len; i++) { final int size = segments[i].length(); segments[i].getChars(0, size, result, offset); offset += size; result[offset++] = SEPARATOR; } final int size = segments[len].length(); segments[len].getChars(0, size, result, offset); offset += size; } if ((separators & HAS_TRAILING) != 0) { result[offset] = SEPARATOR; } return new String(result); }

Target:
public String toString() { final int resultSize = computeLength(); if (resultSize <= 0) { return ""; } char[] result = new char[resultSize]; int offset = 0; if ((separators & HAS_LEADING) != 0) { result[offset++] = SEPARATOR; } final int len = segments.length - 1; if (len >= 0) { for (int i = 0; i < len; i++) { final int size = segments[i].length(); segments[i].getChars(0, size, result, offset); offset += size; result[offset++] = SEPARATOR; } final int size = segments[len].length(); segments[len].getChars(0, size, result, offset); offset += size; } if ((separators & HAS_TRAILING) != 0) { result[offset] = SEPARATOR; } return new String(result); }
Source:
private void removeApplicationSignUp(ApplicationContext applicationContext){ try { if (log.isInfoEnabled()) { log.info(String.format("Removing application signup: [application-id] %s", applicationContext.getApplicationId())); } StratosManagerServiceClient serviceClient = StratosManagerServiceClient.getInstance(); ApplicationSignUp applicationSignUp[] = serviceClient.getApplicationSignUps(applicationContext.getApplicationId()); for(ApplicationSignUp appSignUp : applicationSignUp) { serviceClient.removeApplicationSignUp(appSignUp.getApplicationId(), appSignUp.getTenantId()); } }catch(Exception e){ String message = "Could not remove application signup(s)"; log.error(message, e); throw new RuntimeException(message, e); } }

Target:
private void removeApplicationSignUp(ApplicationContext applicationContext){ try { if (log.isInfoEnabled()) { log.info(String.format("Removing application signup: [application-id] %s", applicationContext.getApplicationId())); } StratosManagerServiceClient serviceClient = StratosManagerServiceClient.getInstance(); ApplicationSignUp applicationSignUp[] = serviceClient.getApplicationSignUps(applicationContext.getApplicationId()); if ( applicationSignUp != null){ for(ApplicationSignUp appSignUp : applicationSignUp) { if ( appSignUp != null) { serviceClient.removeApplicationSignUp(appSignUp.getApplicationId(), appSignUp.getTenantId()); } } } }catch(Exception e){ String message = "Could not remove application signup(s)"; log.error(message, e); throw new RuntimeException(message, e); } }
Source:
public void perform_read_bulk_operations() { final int count = 10; final List<I> ids = new LinkedList<>(); for (int i = 0; i < count; i++) { final I id = newId(); final ProjectId projectId = ProjectId.newBuilder() .setId(id.toString()) .build(); final Project state = Project.newBuilder() .setId(projectId) .build(); final Any packedState = AnyPacker.pack(state); final EntityStorageRecord record = EntityStorageRecord.newBuilder() .setState(packedState) .setWhenModified(Timestamps.getCurrentTime()) .setVersion(1) .build(); storage.write(id, record); if (i % 2 == 0) { ids.add(id); } } final Iterable<EntityStorageRecord> read = storage.readBulk(ids); assertSize(ids.size(), read); for (EntityStorageRecord record : read) { final Any packedState = record.getState(); final Project state = AnyPacker.unpack(packedState); final ProjectId id = state.getId(); final String stringIdRepr = id.getId(); boolean isIdPresent = false; for (I genericId : ids) { isIdPresent = genericId.toString() .equals(stringIdRepr); if (isIdPresent) { break; } } assertTrue(isIdPresent); } }

Target:
public void perform_read_bulk_operations() { final List<I> ids = fillStorage(10).subList(0, 5); final Iterable<EntityStorageRecord> read = storage.readBulk(ids); assertSize(ids.size(), read); for (EntityStorageRecord record : read) { checkProjectIdIsInList(record, ids); } }
Source:
private CorsResponseHelper getCorsResponseHelper() { if (corsResponseHelper == null) { corsResponseHelper = new CorsResponseHelper() .setAllowCredentials(allowCredentials) .setAllowOrigin(allowOrigin) .setAllowOnlyRequestedMethod(allowOnlyRequestedMethod) .setAllowMethods(allowMethods) .setAllowOnlyRequestedMethod(allowOnlyRequestedMethod) .setAllowOnlyRequestedHeaders(allowOnlyRequestedHeader) .setAllowHeaders(allowHeaders); } return corsResponseHelper; }

Target:
protected CorsResponseHelper getCorsResponseHelper() { if (corsResponseHelper == null) { corsResponseHelper = new CorsResponseHelper() .setAllowedCredentials(allowedCredentials) .setAllowedOrigins(allowedOrigins) .setAllowAllRequestedHeaders(allowAllRequestedHeaders) .setAllowedHeaders(allowedHeaders) .setExposedHeaders(exposedHeaders); } return corsResponseHelper; }
Source:
public OntologyTerm getTerm(String id) { OntologyTerm result = this.cache.get(id); if (result == null) { id = id.replaceAll("\\s", ""); HttpGet method = new HttpGet(this.fetchServiceURL + "symbol/" + id); method.setHeader(HttpHeaders.ACCEPT, ContentType.APPLICATION_JSON.getMimeType()); try (CloseableHttpResponse httpResponse = this.client.execute(method)) { String response = IOUtils.toString(httpResponse.getEntity().getContent(), Consts.UTF_8); JSONObject responseJSON = (JSONObject) JSONSerializer.toJSON(response); JSONArray docs = responseJSON.getJSONObject(RESPONSE_KEY).getJSONArray(DATA_KEY); if (docs.size() == 1) { result = new JSONOntologyTerm(docs.getJSONObject(0), this); this.cache.set(id, result); } else { this.cache.set(id, EMPTY_MARKER); } } catch (IOException ex) { this.logger.warn("Failed to fetch gene definition: {}", ex.getMessage()); } } return (result == EMPTY_MARKER) ? null : result; }

Target:
public OntologyTerm getTerm(String id) { OntologyTerm result = this.cache.get(id); String safeID; if (result == null) { try { safeID = URLEncoder.encode(id, Consts.UTF_8.name()); } catch (UnsupportedEncodingException e) { safeID = id.replaceAll("\\s", ""); this.logger.warn("Could not find the encoding: {}", Consts.UTF_8.name()); } HttpGet method = new HttpGet(this.fetchServiceURL + "symbol/" + safeID); method.setHeader(HttpHeaders.ACCEPT, ContentType.APPLICATION_JSON.getMimeType()); try (CloseableHttpResponse httpResponse = this.client.execute(method)) { String response = IOUtils.toString(httpResponse.getEntity().getContent(), Consts.UTF_8); JSONObject responseJSON = (JSONObject) JSONSerializer.toJSON(response); JSONArray docs = responseJSON.getJSONObject(RESPONSE_KEY).getJSONArray(DATA_KEY); if (docs.size() == 1) { result = new JSONOntologyTerm(docs.getJSONObject(0), this); this.cache.set(id, result); } else { this.cache.set(id, EMPTY_MARKER); } } catch (IOException ex) { this.logger.warn("Failed to fetch gene definition: {}", ex.getMessage()); } } return (result == EMPTY_MARKER) ? null : result; }
Source:
public void testMessageOrderingWhenConsuming() throws IOException, InterruptedException { String queueName = "message_ordering_test"; String address = queueName + ".address"; int count = 1000; CountDownLatch latch = new CountDownLatch(count - 1); List<String> sendingOrder = IntStream.range(1, count).boxed().map(Object::toString).collect(Collectors.toList()); ArrayBlockingQueue<String> receiveOrderQueue = new ArrayBlockingQueue<>(count); receiveOrderQueue.addAll(sendingOrder); AMQP.Queue.DeclareOk ok = channel.queueDeclare(queueName, false, false, true, null); assertNotNull(ok.getQueue()); AMQP.BasicProperties properties = new AMQP.BasicProperties.Builder().contentType("text/plain").contentEncoding("UTF-8").build(); for (String msg : sendingOrder) channel.basicPublish("", queueName, properties, msg.getBytes("UTF-8")); vertx.eventBus().consumer(address, msg -> { String expectedMessage = receiveOrderQueue.poll(); assertNotNull(msg); JsonObject json = (JsonObject) msg.body(); assertNotNull(json); String body = json.getString("body"); assertNotNull(body); log.info("received: " + body + " expected: " + expectedMessage); assertTrue(body.equals(expectedMessage)); latch.countDown(); }); client.basicConsume(queueName, address, onSuccess(v -> { })); awaitLatch(latch); testComplete(); }

Target:
public void testMessageOrderingWhenConsuming() throws IOException { String queueName = "message_ordering_test"; String address = queueName + ".address"; int count = 1000; List<String> sendingOrder = IntStream.range(1, count).boxed().map(Object::toString).collect(Collectors.toList()); AMQP.Queue.DeclareOk ok = channel.queueDeclare(queueName, false, false, true, null); assertNotNull(ok.getQueue()); AMQP.BasicProperties properties = new AMQP.BasicProperties.Builder().contentType("text/plain").contentEncoding("UTF-8").build(); for (String msg : sendingOrder) channel.basicPublish("", queueName, properties, msg.getBytes("UTF-8")); List<String> receivedOrder = Collections.synchronizedList(new ArrayList<>()); vertx.eventBus().consumer(address, msg -> { assertNotNull(msg); JsonObject json = (JsonObject) msg.body(); assertNotNull(json); String body = json.getString("body"); assertNotNull(body); receivedOrder.add(body); }); client.basicConsume(queueName, address, onSuccess(v -> { })); assertWaitUntil(() -> receivedOrder.size() == sendingOrder.size()); for (int i = 0; i < sendingOrder.size(); i++) { assertTrue(sendingOrder.get(i).equals(receivedOrder.get(i))); } }
Source:
public Transaction accessTransaction() { if ( this.currentHibernateTransaction == null || ( this.currentHibernateTransaction.getStatus() != TransactionStatus.ACTIVE && !isClosed() ) ) { this.currentHibernateTransaction = new TransactionImpl( getTransactionCoordinator(), getExceptionConverter(), getFactory().getSessionFactoryOptions().getJpaCompliance(), isClosed() ); } if ( !isClosed() || (waitingForAutoClose && factory.isOpen()) ) { getTransactionCoordinator().pulse(); } return this.currentHibernateTransaction; }

Target:
public Transaction accessTransaction() { if ( this.currentHibernateTransaction == null ) { this.currentHibernateTransaction = new TransactionImpl( getTransactionCoordinator(), getExceptionConverter(), this ); } if ( !isClosed() || (waitingForAutoClose && factory.isOpen()) ) { getTransactionCoordinator().pulse(); } return this.currentHibernateTransaction; }
Source:
public LeasedConnection connect(Properties connectionProperties) throws ConnectionException { LeasedConnection connection = LeasedConnectionFactory.connect(servers, connectionProperties); try { EntityRef<DynamicTopologyEntity, Object, DynamicTopologyEntity.Settings> ref = connection.getEntityRef(DynamicTopologyEntity.class, 1, DynamicTopologyEntityConstants.ENTITY_NAME); DynamicTopologyEntity dynamicTopologyEntity = ref.fetchEntity(null); dynamicTopologyEntity.setListener(new DynamicTopologyEntity.Listener() { @Override public void onNodeRemoval(int stripeId, Node removedNode) { servers.remove(removedNode.getNodeAddress()); } @Override public void onNodeAddition(int stripeId, Node addedNode) { servers.add(addedNode.getNodeAddress()); } }); return new LeasedConnection() { @Override public void close() throws IOException { dynamicTopologyEntity.close(); connection.close(); } @Override public <T extends Entity, C, U> EntityRef<T, C, U> getEntityRef(Class<T> cls, long version, String name) throws EntityNotProvidedException { return connection.getEntityRef(cls, version, name); } }; } catch (Exception e) { throw new ConnectionException(e); } }

Target:
public LeasedConnection connect(Properties connectionProperties) throws ConnectionException { LeasedConnection connection = LeasedConnectionFactory.connect(servers, connectionProperties); try { EntityRef<DynamicTopologyEntity, Object, DynamicTopologyEntity.Settings> ref = connection.getEntityRef(DynamicTopologyEntity.class, 1, DynamicTopologyEntityConstants.ENTITY_NAME); DynamicTopologyEntity dynamicTopologyEntity = ref.fetchEntity(null); dynamicTopologyEntity.setListener(new DynamicTopologyEntity.Listener() { @Override public void onNodeRemoval(int stripeId, Node removedNode) { servers.remove(removedNode.getNodeAddress()); } @Override public void onNodeAddition(int stripeId, Node addedNode) { servers.add(addedNode.getNodeAddress()); } }); return new LeasedConnection() { @Override public <T extends Entity, C, U> EntityRef<T, C, U> getEntityRef(Class<T> cls, long version, String name) throws EntityNotProvidedException { return connection.getEntityRef(cls, version, name); } @Override public void close() throws IOException { Future<?> close = dynamicTopologyEntity.releaseEntity(); try { close.get(10, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (ExecutionException e) { throw new IOException(e.getCause()); } catch (TimeoutException e) { } finally { connection.close(); } } }; } catch (EntityNotProvidedException | EntityVersionMismatchException | EntityNotFoundException e) { throw new AssertionError(e); } }
Source:
protected static int getPartitionIdFromZKPath(String zkPath) { String array[] = zkPath.split("/"); return Integer.valueOf(array[array.length - 1]); }

Target:
protected static int getPartitionIdFromZKPath(String zkPath) { return Integer.parseInt(zkPath.substring(zkPath.lastIndexOf('/') + 1)); }
Source:
public void setGrantType(String grantType) { setProperty(GRANT_TYPE, grantType); }

Target:
protected void setGrantType(String grantType) { setProperty(GRANT_TYPE, grantType); }
Source:
public FlowTypeTree FLOW_FUNCTION_TYPE_OR_HIGHER() { return b.<FlowTypeTree>nonterminal(Kind.FLOW_FUNCTION_TYPE) .is(b.firstOf( f.flowFunctionType( b.optional(FLOW_GENERIC_PARAMETER_CLAUSE()), FLOW_FUNCTION_TYPE_PARAMETER_CLAUSE(), b.token(JavaScriptPunctuator.DOUBLEARROW), FLOW_TYPE()), f.flowFunctionType(FLOW_UNION_TYPE_OR_HIGHER(), b.token(JavaScriptPunctuator.DOUBLEARROW), FLOW_FUNCTION_TYPE_OR_HIGHER()), FLOW_UNION_TYPE_OR_HIGHER() )); }

Target:
public FlowTypeTree FLOW_FUNCTION_TYPE_OR_HIGHER() { return b.<FlowTypeTree>nonterminal(Kind.FLOW_FUNCTION_TYPE) .is(b.firstOf( f.flowFunctionType( b.optional(FLOW_GENERIC_PARAMETER_CLAUSE()), b.firstOf(FLOW_FUNCTION_TYPE_PARAMETER_CLAUSE(), f.flowFunctionTypeSingleParameterClause(FLOW_UNION_TYPE_OR_HIGHER())), b.token(JavaScriptPunctuator.DOUBLEARROW), FLOW_TYPE()), FLOW_UNION_TYPE_OR_HIGHER())); }
Source:
public void testDebugLogPrinting() { Logger logger = createLogger(LogLevel.DEBUG); String debug = "debug"; logger.debug(debug); assertLastMessage(debug); }

Target:
public void testDebugLogPrinting() { Logger logger = createLogger(LogLevel.DEBUG); String message = "debug"; logger.debug(message); assertLastLogMessageEquals(message); }
Source:
public com.alliander.osgp.dto.valueobjects.smartmetering.SpecialDay convert(final SpecialDay source, final Type<? extends com.alliander.osgp.dto.valueobjects.smartmetering.SpecialDay> destinationType) { final com.alliander.osgp.domain.core.valueobjects.smartmetering.CosemDate cosemDate = source .getSpecialDayDate(); return new com.alliander.osgp.dto.valueobjects.smartmetering.SpecialDay(new CosemDate(cosemDate.getYear(), cosemDate.getMonth(), cosemDate.getDayOfMonth(), cosemDate.getDayOfWeek()), source.getDayId()); }

Target:
public com.alliander.osgp.dto.valueobjects.smartmetering.SpecialDay convert(final SpecialDay source, final Type<? extends com.alliander.osgp.dto.valueobjects.smartmetering.SpecialDay> destinationType) { return new com.alliander.osgp.dto.valueobjects.smartmetering.SpecialDay(this.mapperFacade.map( source.getSpecialDayDate(), CosemDate.class), source.getDayId()); }
Source:
public List<AudioData> speak(String toSpeak) { if (mouth != null && !mute) { try { return mouth.speak(toSpeak); } catch (Exception e) { Logging.logError(e); } } return null; }

Target:
public List<AudioData> speak(String toSpeak) { if (mouth == null) { log.error("Speak is called, but my mouth is NULL..."); return null; } if (!mute) { try { return mouth.speak(toSpeak); } catch (Exception e) { Logging.logError(e); } } return null; }
Source:
public Connection<CL> createConnection() { try { Connection<CL> connection = connFactory.createConnection((HostConnectionPool<CL>) pool, null); connection.open(); availableConnections.add(connection); monitor.incConnectionCreated(host); numActiveConnections.incrementAndGet(); return connection; } catch (DynoConnectException e) { if (monitor.getConnectionCreateFailedCount() % 10000 == 0) { Logger.error("Failed to create connection", e); } monitor.incConnectionCreateFailed(host, e); throw e; } catch (RuntimeException e) { if (monitor.getConnectionCreateFailedCount() % 10000 == 0) { Logger.error("Failed to create connection", e); } monitor.incConnectionCreateFailed(host, e); throw new DynoConnectException(e); } }

Target:
public Connection<CL> createConnection() { try { Connection<CL> connection = connFactory.createConnection((HostConnectionPool<CL>) pool, null); connection.open(); availableConnections.add(connection); monitor.incConnectionCreated(host); numActiveConnections.incrementAndGet(); return connection; } catch (DynoConnectException e) { if (Logger.isDebugEnabled()) { if (monitor.getConnectionCreateFailedCount() % 10000 == 0) { Logger.error("Failed to create connection", e); } } monitor.incConnectionCreateFailed(host, e); throw e; } catch (RuntimeException e) { if (monitor.getConnectionCreateFailedCount() % 10000 == 0) { Logger.error("Failed to create connection", e); } monitor.incConnectionCreateFailed(host, e); throw new DynoConnectException(e); } }
Source:
public void addListener(UnitedServerListener listener) { boolean requiresInit = false; synchronized(this) { if( !list.contains(listener)) { list.add(listener); requiresInit = isInitialized; } } if( requiresInit ) { initializeListener(listener); } }

Target:
public void addListener(UnitedServerListener listener) { boolean requiresInit = false; synchronized(this) { if( !list.contains(listener)) { requiresInit = isInitialized(); list.add(listener); } } if( requiresInit ) { initializeListener(listener); } }
Source:
private Promise<Void> initializeChangeMarkersRender() { OrionTextViewOverlay textView = editorWidget.getTextView(); List<OrionExtRulerOverlay> rulers = Arrays.asList(textView.getRulers()); OrionStyleOverlay style = OrionStyleOverlay.create(); style.setStyleClass("vcsChangeMarker"); OrionAttributesOverlay attributesOverlay = OrionAttributesOverlay.create(); attributesOverlay.setAttribute( "style", "width: 8px; position: relative; float: left; background-color: " + org.eclipse.che.ide.api.theme.Style.theme.editorGutterLineNumberBackgroundColor()); style.setAttributes(attributesOverlay); return Promises.create( (resolve, reject) -> OrionExtRulerOverlay.create( editorWidget.getEditor().getAnnotationModel(), style, OrionExtRulerOverlay.RulerLocation.LEFT.getLocation(), OrionExtRulerOverlay.RulerOverview.PAGE.getOverview(), orionExtRulerOverlay -> { int rulerPosition = 0; OrionExtRulerOverlay rulerLines = getRuler(rulers, "ruler lines"); if (rulerLines != null) { rulerPosition = rulers.indexOf(rulerLines) + 1; } else { OrionExtRulerOverlay rulerAnnotations = getRuler(rulers, "ruler annotations"); if (rulerAnnotations != null) { rulerPosition = rulers.indexOf(rulerAnnotations) + 1; } } textView.addRuler(orionExtRulerOverlay, rulerPosition); OrionVcsChangeMarkersRuler orionVcsChangeMarkersRuler = new OrionVcsChangeMarkersRuler( orionExtRulerOverlay, editorWidget.getEditor()); this.vcsChangeMarkerRender = vcsChangeMarkerRenderFactory.create(orionVcsChangeMarkersRuler); resolve.apply(null); })); }

Target:
private Promise<Void> initializeChangeMarkersRender() { OrionTextViewOverlay textView = editorWidget.getTextView(); List<OrionExtRulerOverlay> rulers = Arrays.asList(textView.getRulers()); OrionStyleOverlay style = OrionStyleOverlay.create(); style.setStyleClass("ruler vcs"); return Promises.create( (resolve, reject) -> OrionExtRulerOverlay.create( editorWidget.getEditor().getAnnotationModel(), style, OrionExtRulerOverlay.RulerLocation.LEFT.getLocation(), OrionExtRulerOverlay.RulerOverview.PAGE.getOverview(), orionExtRulerOverlay -> { int rulerPosition; for (rulerPosition = 0; rulerPosition < rulers.size() - 1; rulerPosition++) { String rulerStyleClass = rulers.get(rulerPosition).getStyle().getStyleClass(); if ("ruler lines".equals(rulerStyleClass)) { break; } } textView.addRuler(orionExtRulerOverlay, rulerPosition + 1); OrionVcsChangeMarkersRuler orionVcsChangeMarkersRuler = new OrionVcsChangeMarkersRuler( orionExtRulerOverlay, editorWidget.getEditor()); this.vcsChangeMarkerRender = vcsChangeMarkerRenderFactory.create(orionVcsChangeMarkersRuler); resolve.apply(null); })); }
Source:
public DiskProfile getProfile() { if (profile == null) { if (getParameters().getProfile() == null) { if (getParameters().getProfileId() != null) { profile = getProfileDao().get(getParameters().getProfileId()); } } else { profile = getParameters().getProfile(); } } return profile; }

Target:
public DiskProfile getProfile() { if (profile == null) { if (getParameters().getProfile() != null) { profile = getParameters().getProfile(); } else if (getParameters().getProfileId() != null) { profile = getProfileDao().get(getParameters().getProfileId()); } else { log.error("couldn't find disk profile"); } } return profile; }
Source:
public void process(JSONRequestContext requestContext) { StudentGroupContactLogEntryDAO entryDAO = DAOFactory.getInstance().getStudentGroupContactLogEntryDAO(); Long entryId = requestContext.getLong("entryId"); StudentGroupContactLogEntry entry = entryDAO.findById(entryId); entryDAO.archive(entry); }

Target:
public void process(JSONRequestContext requestContext) { StudentGroupContactLogEntryDAO entryDAO = DAOFactory.getInstance().getStudentGroupContactLogEntryDAO(); Long entryId = requestContext.getLong("entryId"); if (entryId == null) throw new SmvcRuntimeException(StatusCode.UNDEFINED, "EntryId was not defined."); StudentGroupContactLogEntry entry = entryDAO.findById(entryId); entryDAO.archive(entry); }
Source:
public String getCommitStatusFromPatch(Patch patch) throws NotFoundException { PullRequestService pullrequestService = new PullRequestService(gitHubClient); CommitService commitService = new CommitService(gitHubClient); String sha = null; Optional<String> status = null; URL url = patch.getURL(); int patchId = Integer.parseInt(patch.getId()); checkHost(url); RepositoryId repositoryId = RepositoryId.createFromUrl(url); try { List<RepositoryCommit> commits = pullrequestService.getCommits(repositoryId, patchId); if (commits.size() > 0) { sha = commits.get(commits.size() - 1).getSha(); } List<CommitStatus> statuses = commitService.getStatuses(repositoryId, sha); if (statuses.size() > 0) { status = Optional.ofNullable(statuses.get(0).getState()); } } catch (IOException e) { Utils.logException(LOG, e); throw new NotFoundException(e); } if (status.isPresent()) { return status.get(); } else { Utils.logWarnMessage(LOG, "in the " + patch + "commit status is not present"); return null; } }

Target:
public org.jboss.set.aphrodite.domain.CommitStatus getCommitStatusFromPatch(Patch patch) throws NotFoundException { PullRequestService pullrequestService = new PullRequestService(gitHubClient); CommitService commitService = new CommitService(gitHubClient); String sha = null; org.jboss.set.aphrodite.domain.CommitStatus status = null; URL url = patch.getURL(); int patchId = Integer.parseInt(patch.getId()); checkHost(url); RepositoryId repositoryId = RepositoryId.createFromUrl(url); try { List<RepositoryCommit> commits = pullrequestService.getCommits(repositoryId, patchId); if (commits.size() > 0) { sha = commits.get(commits.size() - 1).getSha(); } List<CommitStatus> statuses = commitService.getStatuses(repositoryId, sha); if (statuses.size() > 0) { String sta = getCombineStatus(statuses); status = org.jboss.set.aphrodite.domain.CommitStatus.fromString(sta); } } catch (IOException e) { Utils.logException(LOG, e); throw new NotFoundException(e); } if (status != null) { return status; } else { throw new NotFoundException("No commit status found for patch:" + patch.getURL()); } }
Source:
protected ReferencedProjectPickerDialog(final Shell parentShell, IProject project) { super(parentShell, new ColumnLabelProvider() { @Override public String getText(Object element) { IProject project = (IProject) element; return project.getName(); } @Override public Image getImage(Object element) { try { return new Image(parentShell.getDisplay(), new URL("platform:/plugin/org.eclipse.ui.images/eclipse-png/org.eclipse.jdt.ui/icons/full/eview16/projects.png").openStream()); } catch (Exception e) { e.printStackTrace(); return super.getImage(element); } } }); this.project = project; }

Target:
protected ReferencedProjectPickerDialog(final Shell parentShell, IProject project) { super(parentShell, new ColumnLabelProvider() { @Override public String getText(Object element) { IProject project = (IProject) element; return project.getName(); } @Override public Image getImage(Object element) { return imgProject; } }); this.project = project; }
Source:
public void doPatchProcessing(Context context, Request currentRequest, InProgressSubmission source, Operation op, SubmissionStepConfig stepConf) throws Exception { String instance = ""; if ("remove".equals(op.getOp())) { if (op.getPath().contains(UPLOAD_STEP_METADATA_PATH)) { instance = UPLOAD_STEP_METADATA_OPERATION_ENTRY; } else if (op.getPath().contains(UPLOAD_STEP_ACCESSCONDITIONS_OPERATION_ENTRY)) { instance = UPLOAD_STEP_ACCESSCONDITIONS_OPERATION_ENTRY; } else { instance = UPLOAD_STEP_REMOVE_OPERATION_ENTRY; } } else if ("move".equals(op.getOp())) { if (op.getPath().contains(UPLOAD_STEP_METADATA_PATH)) { instance = UPLOAD_STEP_METADATA_OPERATION_ENTRY; } else { instance = UPLOAD_STEP_MOVE_OPERATION_ENTRY; } } else { if (op.getPath().contains(UPLOAD_STEP_ACCESSCONDITIONS_OPERATION_ENTRY)) { instance = UPLOAD_STEP_ACCESSCONDITIONS_OPERATION_ENTRY; } else { instance = UPLOAD_STEP_METADATA_OPERATION_ENTRY; } } PatchOperation<?> patchOperation = new PatchOperationFactory().instanceOf(instance, op.getOp()); if (instance.equals(AbstractRestProcessingStep.UPLOAD_STEP_METADATA_OPERATION_ENTRY)) { DCInputSet inputConfig = inputReader.getInputsByFormName(UploadStep.UPLOAD_STEP_METADATA_SECTION); String[] split = patchOperation.getAbsolutePath(op.getPath()).split("/"); String metadata = findMetadata(split); if (inputConfig.isFieldPresent(metadata)) { patchOperation.perform(context, currentRequest, source, op); } else { throw new UnprocessableEntityException("The attribute " + metadata + " does not present in section " + UploadStep.UPLOAD_STEP_METADATA_SECTION); } } else { patchOperation.perform(context, currentRequest, source, op); } }

Target:
public void doPatchProcessing(Context context, Request currentRequest, InProgressSubmission source, Operation op, SubmissionStepConfig stepConf) throws Exception { String instance = null; if ("remove".equals(op.getOp())) { if (op.getPath().contains(UPLOAD_STEP_METADATA_PATH)) { instance = UPLOAD_STEP_METADATA_OPERATION_ENTRY; } else if (op.getPath().contains(UPLOAD_STEP_ACCESSCONDITIONS_OPERATION_ENTRY)) { instance = UPLOAD_STEP_ACCESSCONDITIONS_OPERATION_ENTRY; } else { instance = UPLOAD_STEP_REMOVE_OPERATION_ENTRY; } } else if ("move".equals(op.getOp())) { if (op.getPath().contains(UPLOAD_STEP_METADATA_PATH)) { instance = UPLOAD_STEP_METADATA_OPERATION_ENTRY; } else { instance = UPLOAD_STEP_MOVE_OPERATION_ENTRY; } } else { if (op.getPath().contains(UPLOAD_STEP_ACCESSCONDITIONS_OPERATION_ENTRY)) { instance = UPLOAD_STEP_ACCESSCONDITIONS_OPERATION_ENTRY; } else if (op.getPath().contains(UPLOAD_STEP_METADATA_PATH)) { instance = UPLOAD_STEP_METADATA_OPERATION_ENTRY; } } if (instance == null) { throw new UnprocessableEntityException("The path " + op.getPath() + " is not supported by the operation " + op.getOp()); } PatchOperation<?> patchOperation = new PatchOperationFactory().instanceOf(instance, op.getOp()); patchOperation.perform(context, currentRequest, source, op); }
Source:
public PathSpecification(Optional<NodeLocation> location, List<PathElement> path) { super(location); this.path = ImmutableList.copyOf(path); }

Target:
public PathSpecification(Optional<NodeLocation> location, List<PathElement> path) { super(location); this.path = ImmutableList.copyOf(requireNonNull(path, "path is null")); }
Source:
private void validateModelsOnChangeEvent() { getSnapshotName().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { validate("modelPropertiesChanged"); } }); getDaysOfTheWeek().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { validate("modelPropertiesChanged"); } }); getDaysOfMonth().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { validate("modelPropertiesChanged"); } }); getEndDate().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { validate("modelPropertiesChanged"); } }); }

Target:
private void validateModelsOnChangeEvent() { IEventListener<EventArgs> onPropertyChangeValidate = new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { validate("modelPropertiesChanged"); } }; getSnapshotName().getEntityChangedEvent().addListener(onPropertyChangeValidate); getDaysOfTheWeek().getSelectedItemChangedEvent().addListener(onPropertyChangeValidate); getDaysOfMonth().getSelectedItemChangedEvent().addListener(onPropertyChangeValidate); getEndDate().getEntityChangedEvent().addListener(onPropertyChangeValidate); }
Source:
public PooledConnection borrowConnection(ServerLocation server, long acquireTimeout, boolean onlyUseExistingCnx) throws AllConnectionsInUseException, NoAvailableServersException, ServerConnectivityException { PooledConnection connection; logger.trace("Connection borrowConnection single hop connection"); long waitStart = NOT_WAITING; try { long timeout = System.nanoTime() + MILLISECONDS.toNanos(acquireTimeout); while (true) { connection = availableConnectionManager.useFirst((c) -> c.getServer().equals(server)); if (null != connection) { return connection; } if (connectionAccounting.tryCreate()) { try { connection = createPooledConnection(server); } catch (GemFireSecurityException e) { throw new ServerOperationException(e); } finally { if (connection == null) { connectionAccounting.cancelTryCreate(); if (connectionAccounting.isUnderMinimum()) { startBackgroundPrefill(); } } } if (null != connection) { return connection; } throw new ServerConnectivityException(BORROW_CONN_ERROR_MSG + server); } if (!onlyUseExistingCnx) { connection = forceCreateConnection(server); if (null != connection) { return connection; } throw new ServerConnectivityException(BORROW_CONN_ERROR_MSG + server); } if (checkShutdownInterruptedOrTimeout(timeout)) { break; } waitStart = beginConnectionWaitStatIfNotStarted(waitStart); Thread.yield(); } } finally { endConnectionWaitStatIfStarted(waitStart); } cancelCriterion.checkCancelInProgress(null); throw new AllConnectionsInUseException(); }

Target:
public PooledConnection borrowConnection(ServerLocation server, long acquireTimeout, boolean onlyUseExistingCnx) throws AllConnectionsInUseException, NoAvailableServersException, ServerConnectivityException { PooledConnection connection; logger.trace("Connection borrowConnection single hop connection"); long waitStart = NOT_WAITING; try { long timeout = System.nanoTime() + MILLISECONDS.toNanos(acquireTimeout); while (true) { connection = availableConnectionManager.useFirst((c) -> c.getServer().equals(server)); if (null != connection) { return connection; } if (!onlyUseExistingCnx) { connection = forceCreateConnection(server); if (null != connection) { return connection; } throw new ServerConnectivityException(BORROW_CONN_ERROR_MSG + server); } if (checkShutdownInterruptedOrTimeout(timeout)) { break; } waitStart = beginConnectionWaitStatIfNotStarted(waitStart); Thread.yield(); } } finally { endConnectionWaitStatIfStarted(waitStart); } cancelCriterion.checkCancelInProgress(null); throw new AllConnectionsInUseException(); }
Source:
default Direction getBubbleElevatorDirection() { Block block = this.getBlockState().getBlock(); if (block == Blocks.BUBBLE_COLUMN) { return this.getBlockState().get(BubbleColumnBlock.DRAG) ? Direction.DOWN : Direction.UP; } else { return block.getBubbleElevatorDirection(this.getBlockState()); } }

Target:
default Direction getBubbleElevatorDirection() { return this.getBlockState().getBlock().getBubbleElevatorDirection(this.getBlockState()); }
Source:
public <T> T sendMessage(final String msg, final ResponseHandler<T> handler) { final StringBuilder response = new StringBuilder(); final Socket socket = new Socket(); try { socket.connect(new InetSocketAddress(hostname, port), timeout); final InputStreamReader in = new InputStreamReader( socket.getInputStream(), US_ASCII); final OutputStreamWriter out = new OutputStreamWriter( socket.getOutputStream(), US_ASCII); logger.debug(">> {}", msg); out.write(msg); out.write(0); out.flush(); int l; while ((l = in.read()) > 0) { response.append((char) l); } } catch (final IOException e) { logger.error( "Failed to connect to neohub [host '{}' port '{}' timeout '{}']", new Object[] { hostname, port, timeout }); logger.debug("Failed to connect to neohub.", e); return null; } finally { try { socket.close(); } catch (IOException e) { } } final String responseStr = response.toString(); logger.debug("<< {}", responseStr); if (handler != null) { return handler.onResponse(responseStr); } else return null; }

Target:
public <T> T sendMessage(final String msg, final ResponseHandler<T> handler) { final StringBuilder response = new StringBuilder(); final Socket socket = new Socket(); try { socket.connect(new InetSocketAddress(hostname, port), timeout); final InputStreamReader in = new InputStreamReader( socket.getInputStream(), US_ASCII); final OutputStreamWriter out = new OutputStreamWriter( socket.getOutputStream(), US_ASCII); logger.debug(">> {}", msg); out.write(msg); out.write(0); out.flush(); int l; while ((l = in.read()) > 0) { response.append((char) l); } } catch (final IOException e) { logger.error( "Failed to connect to neohub [host '{}' port '{}' timeout '{}']", new Object[] { hostname, port, timeout }); logger.debug("Failed to connect to neohub.", e); return null; } finally { IOUtils.closeQuietly(socket); } final String responseStr = response.toString(); logger.debug("<< {}", responseStr); if (handler != null) { return handler.onResponse(responseStr); } else return null; }
Source:
public void testValidDataSizeAfterPuts() throws InterruptedException, StoreException, IOException { state.advanceTime(Time.MsPerSec); long timeInMsBeforePuts = state.time.milliseconds(); long totalLogSegmentValidSizeBeforePuts = verifyLogSegmentValidSize(new TimeRange(timeInMsBeforePuts, 0L)); long totalContainerValidSizeBeforePuts = verifyContainerValidSize(); state.addPutEntries(3, CuratedLogIndexState.PUT_RECORD_SIZE, Utils.Infinite_Time); state.advanceTime(Time.MsPerSec); long timeInMsAfterPuts = state.time.milliseconds(); verifyLogSegmentValidSize(new TimeRange(timeInMsAfterPuts, 0L)); long totalLogSegmentValidSizeAfterPuts = verifyLogSegmentValidSize(new TimeRange(timeInMsAfterPuts, 0L)); long totalContainerValidSizeAfterPuts = verifyContainerValidSize(); long expectedIncrement = 3 * CuratedLogIndexState.PUT_RECORD_SIZE; assertEquals("Put entries are not properly counted for log segment valid size", totalLogSegmentValidSizeAfterPuts, totalLogSegmentValidSizeBeforePuts + expectedIncrement); assertEquals("Put entries are not properly counted for container valid size", totalContainerValidSizeAfterPuts, totalContainerValidSizeBeforePuts + expectedIncrement); }

Target:
public void testValidDataSizeAfterPuts() throws InterruptedException, StoreException, IOException { advanceTimeToNextSecond(); long timeInMsBeforePuts = state.time.milliseconds(); long totalLogSegmentValidSizeBeforePuts = verifyAndGetLogSegmentValidSize(new TimeRange(timeInMsBeforePuts, 0L)); long totalContainerValidSizeBeforePuts = verifyAndGetContainerValidSize(); state.addPutEntries(3, CuratedLogIndexState.PUT_RECORD_SIZE, Utils.Infinite_Time); long timeInMsAfterPuts = state.time.milliseconds(); long totalLogSegmentValidSizeAfterPuts = verifyAndGetLogSegmentValidSize(new TimeRange(timeInMsAfterPuts, 0L)); long totalContainerValidSizeAfterPuts = verifyAndGetContainerValidSize(); long expectedIncrement = 3 * CuratedLogIndexState.PUT_RECORD_SIZE; assertEquals("Put entries are not properly counted for log segment valid size", totalLogSegmentValidSizeAfterPuts, totalLogSegmentValidSizeBeforePuts + expectedIncrement); assertEquals("Put entries are not properly counted for container valid size", totalContainerValidSizeAfterPuts, totalContainerValidSizeBeforePuts + expectedIncrement); }
Source:
public void processBuffer() { for (LogReplicationEntry entry : buffer.values()) { LogReplicationEntryMetadata metadata = entry.getMetadata(); if (metadata.getTimestamp() < lastProcessedSeq) { buffer.remove(metadata.getPreviousTimestamp()); } else if (metadata.getPreviousTimestamp() <= lastProcessedSeq && metadata.getTimestamp() > lastProcessedSeq) { sinkManager.processMessage(entry); ackCnt++; buffer.remove(lastProcessedSeq); lastProcessedSeq = getCurrentSeq(entry); } } }

Target:
public void processBuffer() { for (LogReplicationEntry entry : buffer.values()) { LogReplicationEntryMetadata metadata = entry.getMetadata(); if (metadata.getTimestamp() <= lastProcessedSeq) { buffer.remove(metadata.getPreviousTimestamp()); } else if (metadata.getPreviousTimestamp() <= lastProcessedSeq && metadata.getTimestamp() > lastProcessedSeq) { sinkManager.processMessage(entry); ackCnt++; buffer.remove(lastProcessedSeq); lastProcessedSeq = getCurrentSeq(entry); } } }
Source:
public void publishModel(int tenantId, String userName, long modelId) throws InvalidRequestException, MLModelPublisherException { InputStream in = null; String errorMsg = "Failed to publish the model [id] "; try { MLStorage storage = databaseService.getModelStorage(modelId); if (storage == null) { throw new InvalidRequestException("Invalid model ID: " + modelId); } String storageType = storage.getType(); String storageLocation = storage.getLocation(); MLIOFactory ioFactory = new MLIOFactory(mlProperties); MLInputAdapter inputAdapter = ioFactory.getInputAdapter(storageType + MLConstants.IN_SUFFIX); in = inputAdapter.read(storageLocation); if (in == null) { throw new InvalidRequestException("Invalid model [id] " + modelId); } MLCoreServiceValueHolder valueHolder = MLCoreServiceValueHolder.getInstance(); String modelName = databaseService.getModel(tenantId, userName, modelId).getName(); String registryPath = "/" + valueHolder.getModelRegistryLocation() + "/" + modelName; RegistryOutputAdapter registryOutputAdapter = new RegistryOutputAdapter(); registryOutputAdapter.write(registryPath, in); } catch (DatabaseHandlerException e) { throw new MLModelPublisherException(errorMsg + modelId, e); } catch (MLInputAdapterException e) { throw new MLModelPublisherException(errorMsg + modelId, e); } catch (MLOutputAdapterException e) { throw new MLModelPublisherException(errorMsg + modelId, e); } finally { if (in != null) { try { in.close(); } catch (IOException ignore) { } } } }

Target:
public void publishModel(int tenantId, String userName, long modelId) throws InvalidRequestException, MLModelPublisherException { InputStream in = null; String errorMsg = "Failed to publish the model [id] " + modelId; try { MLStorage storage = databaseService.getModelStorage(modelId); if (storage == null) { throw new InvalidRequestException("Invalid model [id] " + modelId); } String storageType = storage.getType(); String storageLocation = storage.getLocation(); MLIOFactory ioFactory = new MLIOFactory(mlProperties); MLInputAdapter inputAdapter = ioFactory.getInputAdapter(storageType + MLConstants.IN_SUFFIX); in = inputAdapter.read(storageLocation); if (in == null) { throw new InvalidRequestException("Invalid model [id] " + modelId); } MLCoreServiceValueHolder valueHolder = MLCoreServiceValueHolder.getInstance(); String modelName = databaseService.getModel(tenantId, userName, modelId).getName(); String registryPath = "/" + valueHolder.getModelRegistryLocation() + "/" + modelName; RegistryOutputAdapter registryOutputAdapter = new RegistryOutputAdapter(); registryOutputAdapter.write(registryPath, in); } catch (DatabaseHandlerException e) { throw new MLModelPublisherException(errorMsg, e); } catch (MLInputAdapterException e) { throw new MLModelPublisherException(errorMsg, e); } catch (MLOutputAdapterException e) { throw new MLModelPublisherException(errorMsg, e); } finally { if (in != null) { try { in.close(); } catch (IOException ignore) { } } } }
Source:
public static String[] listSerialPorts() { ArrayList<String> serialPorts = new ArrayList<String>(); Enumeration<CommPortIdentifier> comPorts = CommPortIdentifier.getPortIdentifiers(); while (comPorts.hasMoreElements()) { CommPortIdentifier identifier = (CommPortIdentifier)comPorts.nextElement(); String strName = identifier.getName(); serialPorts.add(strName); } return serialPorts.toArray(new String[serialPorts.size()]); }

Target:
public static String[] listSerialPorts() { ArrayList<String> serialPorts = new ArrayList<String>(); @SuppressWarnings("unchecked") Enumeration<CommPortIdentifier> comPorts = CommPortIdentifier.getPortIdentifiers(); if (comPorts == null) return serialPorts.toArray(new String[serialPorts.size()]); while (comPorts.hasMoreElements()) { CommPortIdentifier identifier = (CommPortIdentifier)comPorts.nextElement(); if (identifier == null) continue; String strName = identifier.getName(); serialPorts.add(strName); } return serialPorts.toArray(new String[serialPorts.size()]); }
Source:
private static void deleteFileIfExists(File to) throws IOException { boolean fileDoesNotExist = to.exists(); if (fileDoesNotExist) { return; } boolean deleteOk = to.delete(); if (deleteOk) { return; } throw new IOException("Unable to delete file: " + to.getAbsolutePath()); }

Target:
private static void deleteFileIfExists(File to) throws IOException { boolean fileDoesNotExist = !to.exists(); if (fileDoesNotExist) { return; } boolean deleteOk = to.delete(); if (deleteOk) { return; } throw new IOException("Unable to delete file: " + to.getAbsolutePath()); }
Source:
@Override public void init(long initUpdCntr, @Nullable byte[] cntrUpdData) { super.init(initUpdCntr, cntrUpdData); log.info("[op=init" + ", grpId=" + grp.groupId() + ", grpName=" + grp.cacheOrGroupName() + ", caches=" + grp.caches() + ", atomicity=" + grp.config().getAtomicityMode() + ", syncMode=" + grp.config().getWriteSynchronizationMode() + ", mode=" + grp.config().getCacheMode() + ", partId=" + partId + ", gapsLen=" + (cntrUpdData != null ? cntrUpdData.length : 0) + ", cur=" + toString() + ']'); }

Target:
@Override public void init(long initUpdCntr, @Nullable byte[] cntrUpdData) { super.init(initUpdCntr, cntrUpdData); log.debug("[op=init" + ", grpId=" + grp.groupId() + ", grpName=" + grp.cacheOrGroupName() + ", caches=" + grp.caches() + ", atomicity=" + grp.config().getAtomicityMode() + ", syncMode=" + grp.config().getWriteSynchronizationMode() + ", mode=" + grp.config().getCacheMode() + ", partId=" + partId + ", gapsLen=" + (cntrUpdData != null ? cntrUpdData.length : 0) + ", cur=" + toString() + ']'); }
Source:
public void testHttpEnumIngestionInvalidPastCollectionTime() throws IOException, URISyntaxException { long timestamp = System.currentTimeMillis() - TIME_DIFF - Configuration.getInstance().getLongProperty( CoreConfig.BEFORE_CURRENT_COLLECTIONTIME_MS ); final String tenant_id = "333333"; String prefix = getPrefix(); final String metric_name = prefix + "enum_metric_test"; Set<Locator> locators = new HashSet<Locator>(); locators.add(Locator.createLocatorFromPathComponents(tenant_id, metric_name)); HttpResponse response = postMetric(tenant_id, postAggregatedPath, "sample_enums_payload.json", timestamp, prefix ); String[] errors = getBodyArray( response ); assertEquals( 400, response.getStatusLine().getStatusCode() ); assertTrue( Pattern.matches( JSONMetricsContainerTest.PAST_COLLECTION_TIME_REGEX, errors[ 1 ] ) ); }

Target:
public void testHttpEnumIngestionInvalidPastCollectionTime() throws IOException, URISyntaxException { long timestamp = System.currentTimeMillis() - TIME_DIFF_MS - Configuration.getInstance().getLongProperty( CoreConfig.BEFORE_CURRENT_COLLECTIONTIME_MS ); final String tenant_id = "333333"; String postfix = getPostfix(); final String metric_name = postfix + "enum_metric_test"; Set<Locator> locators = new HashSet<Locator>(); locators.add(Locator.createLocatorFromPathComponents(tenant_id, metric_name)); HttpResponse response = postMetric(tenant_id, postAggregatedPath, "sample_enums_payload.json", timestamp, postfix ); String[] errors = getBodyArray( response ); assertEquals( 400, response.getStatusLine().getStatusCode() ); assertEquals( ERROR_TITLE, errors[ 0 ] ); assertTrue( Pattern.matches( PAST_COLLECTION_TIME_REGEX, errors[ 1 ] ) ); }
Source:
public HostSetupNetworksParameters createSetupNetworkParams(VdsNetworkInterface nic) { HostSetupNetworksParameters parameters = new HostSetupNetworksParameters(host.getId()); NetworkAttachment managementAttachment = new NetworkAttachment(); managementAttachment.setNetworkId(managementNetwork.getId()); managementAttachment.setNicId(nic.getId()); IpConfiguration ipConfiguration = new IpConfiguration(); if (ipConfiguration.hasPrimaryAddressSet()) { ipConfiguration.getPrimaryAddress().setAddress(nic.getAddress()); ipConfiguration.getPrimaryAddress().setNetmask(nic.getSubnet()); ipConfiguration.getPrimaryAddress().setGateway(nic.getGateway()); } ipConfiguration.setBootProtocol(nic.getBootProtocol()); managementAttachment.setIpConfiguration(ipConfiguration); parameters.getNetworkAttachments().add(managementAttachment); return parameters; }

Target:
public HostSetupNetworksParameters createSetupNetworkParams(VdsNetworkInterface nic) { HostSetupNetworksParameters parameters = new HostSetupNetworksParameters(host.getId()); NetworkAttachment managementAttachment = new NetworkAttachment(); managementAttachment.setNetworkId(managementNetwork.getId()); managementAttachment.setNicId(nic.getId()); IpConfiguration ipConfiguration = new IpConfiguration(); ipConfiguration.getIPv4Addresses().add(createIPv4Address(nic)); ipConfiguration.setBootProtocol(nic.getBootProtocol()); managementAttachment.setIpConfiguration(ipConfiguration); parameters.getNetworkAttachments().add(managementAttachment); return parameters; }