auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void canvasRestApiCall(HttpServletRequest request, HttpServletResponse response) throws IOException { request.setCharacterEncoding("UTF-8"); M_log.debug("canvasRestApiCall(): called"); PrintWriter out = response.getWriter(); response.setContentType("application/json"); Properties appExtSecureProperties = SectionUtilityToolFilter.appExtSecurePropertiesFile; if(appExtSecureProperties!=null) { canvasToken = appExtSecureProperties.getProperty(SectionUtilityToolFilter.PROPERTY_CANVAS_ADMIN); canvasURL = appExtSecureProperties.getProperty(SectionUtilityToolFilter.PROPERTY_CANVAS_URL); } else { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); out = response.getWriter(); out.print(props.getString("property.file.load.error")); out.flush(); M_log.error("Failed to load system properties(sectionsToolProps.properties) for SectionsTool"); return; } if(isAllowedApiRequest(request)) { callType = props.getString(SectionUtilityToolFilter.PROPERTY_CALL_TYPE); if(callType.equals("canvas")){ apiConnectionLogic(request,response); } else{ esbRestApiCall(request,response); } }else { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); out = response.getWriter(); out.print(props.getString("api.not.allowed.error")); out.flush(); } }

Target:
private void canvasRestApiCall(HttpServletRequest request, HttpServletResponse response) throws IOException { request.setCharacterEncoding("UTF-8"); M_log.debug("canvasRestApiCall(): called"); PrintWriter out = response.getWriter(); response.setContentType("application/json"); Properties appExtSecureProperties = SectionUtilityToolFilter.appExtSecureProperties; if(appExtSecureProperties!=null) { canvasToken = appExtSecureProperties.getProperty(SectionUtilityToolFilter.PROPERTY_CANVAS_ADMIN); canvasURL = appExtSecureProperties.getProperty(SectionUtilityToolFilter.PROPERTY_CANVAS_URL); } else { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); out = response.getWriter(); out.print(appExtPropertiesFile.getProperty("property.file.load.error")); out.flush(); M_log.error("Failed to load system properties(sectionsToolProps.properties) for SectionsTool"); return; } if(isAllowedApiRequest(request)) { callType = appExtPropertiesFile.getProperty(SectionUtilityToolFilter.PROPERTY_CALL_TYPE); if(callType.equals("canvas")){ apiConnectionLogic(request,response); } else{ esbRestApiCall(request,response); } }else { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); out = response.getWriter(); out.print(appExtPropertiesFile.getProperty("api.not.allowed.error")); out.flush(); } }
Source:
private static List<Comparable<Object>> getTagsAfterExecution(SuppressionCommentFilter filter, String filename, String... lines) { final FileContents contents = new FileContents(filename, lines); for (int lineNo = 1; lineNo <= lines.length; lineNo++) { final int colNo = lines[lineNo - 1].indexOf(" if (colNo >= 0) { contents.reportSingleLineComment(lineNo, colNo); } } final TreeWalkerAuditEvent dummyEvent = new TreeWalkerAuditEvent(contents, filename, new LocalizedMessage(1, null, null, null, null, Object.class, ""), null); filter.accept(dummyEvent); return Whitebox.getInternalState(filter, "tags"); }

Target:
private static List<Comparable<Object>> getTagsAfterExecution(SuppressionCommentFilter filter, String filename, String... lines) { final FileContents contents = new FileContents(filename, lines); for (int lineNo = 0; lineNo < lines.length; lineNo++) { final int colNo = lines[lineNo].indexOf(" if (colNo >= 0) { contents.reportSingleLineComment(lineNo + 1, colNo); } } final TreeWalkerAuditEvent dummyEvent = new TreeWalkerAuditEvent(contents, filename, new LocalizedMessage(1, null, null, null, null, Object.class, ""), null); filter.accept(dummyEvent); return Whitebox.getInternalState(filter, "tags"); }
Source:
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (mItemList.get(position) instanceof ParentObject) { ParentViewHolder parentViewHolder = (ParentViewHolder) holder; parentViewHolder.setParentItemClickListener(this); onBindParentViewHolder(parentViewHolder, position); } else if (mItemList.get(position) instanceof ChildObject) { onBindChildViewHolder((ChildViewHolder) holder, position); } else { return; } }

Target:
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (mItemList.get(position) instanceof ParentObject) { ParentViewHolder parentViewHolder = (ParentViewHolder) holder; parentViewHolder.setExpanded(((ParentObject) mItemList.get(position)).isExpanded()); parentViewHolder.setParentItemClickListener(this); onBindParentViewHolder(parentViewHolder, position); } else if (mItemList.get(position) instanceof ChildObject) { onBindChildViewHolder((ChildViewHolder) holder, position); } else { throw new IllegalStateException("Incorrect ViewHolder found"); } }
Source:
protected Type[] getFreshArgs() { List<Type> fresh = new LinkedList<>(); for (Type arg : this.args) { if (fresh.contains(arg)) { fresh.add(fresh.get(fresh.indexOf(arg))); } else { fresh.add(arg.getFresh()); } } return fresh.toArray(new Type[fresh.size()]); }

Target:
protected Type[] getFreshArgs() { List<Type> fresh = new LinkedList<>(); Map<Type, Type> staleToFresh = new HashMap<>(); for (Type arg : this.args) { if (staleToFresh.containsKey(arg)) { fresh.add(staleToFresh.get(arg)); } else { Type freshArg = arg.getFresh(); staleToFresh.put(arg, freshArg); fresh.add(freshArg); } } return fresh.toArray(new Type[fresh.size()]); }
Source:
public void testSendAndReceiveBad() throws Exception { Binder<MessageChannel> binder = getBinder(); DirectChannel moduleOutputChannel = new DirectChannel(); DirectChannel moduleInputChannel = new DirectChannel(); Binding<MessageChannel> producerBinding = binder.bindProducer("bad.0", moduleOutputChannel, null); Binding<MessageChannel> consumerBinding = binder.bindConsumer("bad.0", "test", moduleInputChannel, null); Message<?> message = MessageBuilder.withPayload("bad").setHeader(MessageHeaders.CONTENT_TYPE, "foo/bar").build(); final CountDownLatch latch = new CountDownLatch(3); moduleInputChannel.subscribe(new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { latch.countDown(); throw new RuntimeException("bad"); } }); moduleOutputChannel.send(message); assertTrue(latch.await(10, TimeUnit.SECONDS)); consumerBinding.unbind(); consumerBinding.unbind(); }

Target:
public void testSendAndReceiveBad() throws Exception { Binder<MessageChannel> binder = getBinder(); DirectChannel moduleOutputChannel = new DirectChannel(); DirectChannel moduleInputChannel = new DirectChannel(); Binding<MessageChannel> producerBinding = binder.bindProducer("bad.0", moduleOutputChannel, null); Binding<MessageChannel> consumerBinding = binder.bindConsumer("bad.0", "test", moduleInputChannel, null); Message<?> message = MessageBuilder.withPayload("bad").setHeader(MessageHeaders.CONTENT_TYPE, "foo/bar").build(); final CountDownLatch latch = new CountDownLatch(3); moduleInputChannel.subscribe(new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { latch.countDown(); throw new RuntimeException("bad"); } }); moduleOutputChannel.send(message); assertTrue(latch.await(10, TimeUnit.SECONDS)); producerBinding.unbind(); consumerBinding.unbind(); }
Source:
public void run() { processSLALowCandidates(); processSLAHighCandidates(); }

Target:
public void run() { processSLACandidates(); }
Source:
public static RemoteWebDriver driver() { AbstractTestSession testSession = getTestSession(); if (! testSession.isStarted()) { testSession.startSesion(); } RemoteWebDriver rwd = threadLocalWebDriver.get(); if (rwd == null) { throw new IllegalStateException("Driver not initialized. Is @WebTest annotation missing on method?"); } return rwd; }

Target:
public static RemoteWebDriver driver() { AbstractTestSession testSession = getTestSession(); if (! testSession.isStarted()) { testSession.startSesion(); } RemoteWebDriver rwd = threadLocalWebDriver.get(); if (rwd == null) { throw new IllegalStateException("Driver not initialized. Is @WebTest/@MobileTest missing on class/method?"); } return rwd; }
Source:
public void shutdown() throws StoreException { logger.info("Shutting down store manager"); for (DiskManager diskManager : diskManagers) { diskManager.shutdown(); } logger.info("Shutting down store manager complete"); }

Target:
public void shutdown() throws StoreException { logger.info("Shutting down storage manager"); for (DiskManager diskManager : diskManagers) { diskManager.shutdown(); } logger.info("Shutting down storage manager complete"); }
Source:
public BatchWriterConfig merge(BatchWriterConfig other) { BatchWriterConfig result = new BatchWriterConfig(); if (this.maxMemory != null) { result.maxMemory = this.maxMemory; } else if (other.maxMemory != null) { result.maxMemory = other.maxMemory; } if (this.maxLatency != null) { result.maxLatency = this.maxLatency; } else if (other.maxLatency != null) { result.maxLatency = other.maxLatency; } if (this.timeout != null) { result.timeout = this.timeout; } else if (other.timeout != null) { result.timeout = other.timeout; } if (this.maxWriteThreads != null) { result.maxWriteThreads = this.maxWriteThreads; } else if (other.timeout != null) { result.maxWriteThreads = other.maxWriteThreads; } if (this.isDurabilitySet) { result.durability = this.durability; } else if (other.isDurabilitySet) { result.durability = other.durability; } return result; }

Target:
public BatchWriterConfig merge(BatchWriterConfig other) { BatchWriterConfig result = new BatchWriterConfig(); result.maxMemory = merge(this.maxMemory, other.maxMemory); result.maxLatency = merge(this.maxLatency, other.maxLatency); result.timeout = merge(this.timeout, other.timeout); result.maxWriteThreads = merge(this.maxWriteThreads, other.maxWriteThreads); if (this.isDurabilitySet) { result.durability = this.durability; } else if (other.isDurabilitySet) { result.durability = other.durability; } return result; }
Source:
public Response deleteMetadataStoreRealm(@PathParam("realm") String realm) { try { if (!_metadataStoreDirectory.deleteMetadataStoreRealm(_namespace, realm)) { return serverError(); } } catch (IllegalArgumentException ex) { return notFound(ex.getMessage()); } catch (IllegalStateException ex) { return serverError(); } return OK(); }

Target:
public Response deleteMetadataStoreRealm(@PathParam("realm") String realm) { try { if (!_metadataStoreDirectory.deleteMetadataStoreRealm(_namespace, realm)) { return serverError(); } } catch (IllegalArgumentException ex) { return notFound(ex.getMessage()); } return OK(); }
Source:
public Object visit(PropertyIsEqualTo filter, Object extraData) { helper.out = out; FilterFunction_pgNearest nearest = helper.getNearestFilter(filter); FilterFunction_arrayAnyMatch any = helper.getArrayAnyMatch(filter); if (nearest != null) { return helper.visit( nearest, extraData, new FilterToSqlHelper.NearestHelperContext( dialect, (a, b) -> { try { ((PostGISPSDialect) dialect) .encodeGeometryValue( a, helper.getFeatureTypeGeometryDimension(), helper.getFeatureTypeGeometrySRID(), b); } catch (IOException e) { throw new RuntimeException(e); } })); } else if (any != null) { return helper.visit(any, extraData); } else { return super.visit(filter, extraData); } }

Target:
public Object visit(PropertyIsEqualTo filter, Object extraData) { helper.out = out; FilterFunction_pgNearest nearest = helper.getNearestFilter(filter); InArrayFunction inArray = helper.getInArray(filter); if (nearest != null) { return helper.visit( nearest, extraData, new FilterToSqlHelper.NearestHelperContext( dialect, (a, b) -> { try { ((PostGISPSDialect) dialect) .encodeGeometryValue( a, helper.getFeatureTypeGeometryDimension(), helper.getFeatureTypeGeometrySRID(), b); } catch (IOException e) { throw new RuntimeException(e); } })); } else if (inArray != null) { return helper.visit(inArray, extraData); } else { return super.visit(filter, extraData); } }
Source:
public GatewayResponse capture(CaptureGatewayRequest request) { return sandboxCaptureHandler.capture(request); }

Target:
public GatewayResponse<BaseCaptureResponse> capture(CaptureGatewayRequest request) { return sandboxCaptureHandler.capture(request); }
Source:
public void unregisterHandler(Thing thing) { ServiceRegistration<ThingHandler> thingHandlerServiceRegistration = thingHandlers .remove(thing.getUID().toString()); if (thingHandlerServiceRegistration != null) { logger.debug("Removing service registration for handler of thing " + thing.getUID().getAsString()); unregisterHandler(thingHandlerServiceRegistration); } else { logger.error(MessageFormat.format("There is no service registration for a thing handler of thing {0}.", thing.getUID().getAsString())); } ServiceRegistration<ConfigStatusProvider> configStatusProviderServiceRegistration = configStatusProviders .remove(thing.getUID().getAsString()); if (configStatusProviderServiceRegistration != null) { configStatusProviderServiceRegistration.unregister(); } ServiceRegistration<FirmwareUpdateHandler> firmwareUpdateHandlerServiceRegistration = firmwareUpdateHandlers .remove(thing.getUID().getAsString()); if (firmwareUpdateHandlerServiceRegistration != null) { firmwareUpdateHandlerServiceRegistration.unregister(); } }

Target:
public void unregisterHandler(Thing thing) { ServiceRegistration<ThingHandler> thingHandlerServiceRegistration = thingHandlers .remove(thing.getUID().toString()); if (thingHandlerServiceRegistration != null) { logger.debug("Removing service registration for handler of thing '{}'.", thing.getUID().getAsString()); unregisterHandler(thingHandlerServiceRegistration); } else { logger.error("There is no service registration for a thing handler of thing '{}'.", thing.getUID().getAsString()); } ServiceRegistration<ConfigStatusProvider> configStatusProviderServiceRegistration = configStatusProviders .remove(thing.getUID().getAsString()); if (configStatusProviderServiceRegistration != null) { configStatusProviderServiceRegistration.unregister(); } ServiceRegistration<FirmwareUpdateHandler> firmwareUpdateHandlerServiceRegistration = firmwareUpdateHandlers .remove(thing.getUID().getAsString()); if (firmwareUpdateHandlerServiceRegistration != null) { firmwareUpdateHandlerServiceRegistration.unregister(); } }
Source:
private void marshalCategories(Variable variable, VariableState variableState) { int categoryIndex = 0; for(Category c : variable.getCategories()) { CategoryState categoryState; int currentCategoryIndex = variableState.getCategoryIndex(c.getName()); if(currentCategoryIndex == -1) { categoryState = new CategoryState(c.getName(), c.getCode(), c.isMissing()); variableState.getCategories().add(categoryIndex, categoryState); } else { categoryState = variableState.getCategories().get(currentCategoryIndex); if(categoryIndex != currentCategoryIndex) { CategoryState previousCategory = variableState.getCategories().set(categoryIndex, categoryState); variableState.getCategories().set(currentCategoryIndex, previousCategory); } } setAttributes(c, categoryState); categoryIndex++; } if(categoryIndex < variableState.getCategories().size()) { Collection<CategoryState> toDelete = new ArrayList<CategoryState>(); for(int i = categoryIndex; i < variableState.getCategories().size(); i++) { toDelete.add(variableState.getCategories().get(i)); } variableState.getCategories().removeAll(toDelete); } }

Target:
private void marshalCategories(Variable variable, VariableState variableState) { int categoryIndex = 0; for(Category c : variable.getCategories()) { CategoryState categoryState; int currentCategoryIndex = variableState.getCategoryIndex(c.getName()); if(currentCategoryIndex == -1) { categoryState = new CategoryState(c.getName(), c.getCode(), c.isMissing()); variableState.getCategories().add(categoryIndex, categoryState); } else { categoryState = variableState.getCategories().get(currentCategoryIndex); if(categoryIndex != currentCategoryIndex) { CategoryState previousCategory = variableState.getCategories().set(categoryIndex, categoryState); variableState.getCategories().set(currentCategoryIndex, previousCategory); } } setAttributes(c, categoryState); categoryIndex++; } int nbCategories = variableState.getCategories().size(); if(categoryIndex < nbCategories) { Collection<CategoryState> toDelete = new ArrayList<CategoryState>(); for(int i = categoryIndex; i < nbCategories; i++) { toDelete.add(variableState.getCategories().get(i)); } variableState.getCategories().removeAll(toDelete); } }
Source:
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { String hadoopInputFormatClassName = in.readUTF(); String keyClassName = in.readUTF(); String valueClassName = in.readUTF(); if(jobConf == null) { jobConf = new JobConf(); } jobConf.readFields(in); try { this.hadoopInputFormat = (org.apache.hadoop.mapred.InputFormat<K,V>) Class.forName(hadoopInputFormatClassName).newInstance(); } catch (Exception e) { throw new RuntimeException("Unable to instantiate the hadoop input format", e); } try { this.keyClass = (Class<K>) Class.forName(keyClassName); } catch (Exception e) { throw new RuntimeException("Unable to find key class.", e); } try { this.valueClass = (Class<V>) Class.forName(valueClassName); } catch (Exception e) { throw new RuntimeException("Unable to find value class.", e); } ReflectionUtils.setConf(hadoopInputFormat, jobConf); }

Target:
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { String hadoopInputFormatClassName = in.readUTF(); String keyClassName = in.readUTF(); String valueClassName = in.readUTF(); if(jobConf == null) { jobConf = new JobConf(); } jobConf.readFields(in); try { this.mapredInputFormat = (org.apache.hadoop.mapred.InputFormat<K,V>) Class.forName(hadoopInputFormatClassName, true, Thread.currentThread().getContextClassLoader()).newInstance(); } catch (Exception e) { throw new RuntimeException("Unable to instantiate the hadoop input format", e); } try { this.keyClass = (Class<K>) Class.forName(keyClassName, true, Thread.currentThread().getContextClassLoader()); } catch (Exception e) { throw new RuntimeException("Unable to find key class.", e); } try { this.valueClass = (Class<V>) Class.forName(valueClassName, true, Thread.currentThread().getContextClassLoader()); } catch (Exception e) { throw new RuntimeException("Unable to find value class.", e); } ReflectionUtils.setConf(mapredInputFormat, jobConf); }
Source:
protected void setDirty(boolean dirty) { fDirty = fDirty || dirty; editorDirtyStateChanged(); if (fDirty && getActivePage() == getPageCount() - 1) { updateTargetDocumentEditor(); } }

Target:
protected void setDirty(boolean dirty) { fDirty = fDirty || dirty; editorDirtyStateChanged(); if (fDirty && isActiveTabTextualEditor()) { updateTextualEditor(); } }
Source:
public static FormValidation validateExecutable(String exe, FileValidator exeValidator) { if(!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) return ok(); final FormValidation[] result = {null}; try { DOSToUnixPathHelper.iteratePath(exe, new DOSToUnixPathHelper.Helper() { @Override public void ok() { result[0] = FormValidation.ok(); } @Override public void checkExecutable(File fexe) { result[0] = exeValidator.validate(fexe); } @Override public void error(String string) { result[0] = FormValidation.error(string); } @Override public void validate(File fexe) { result[0] = exeValidator.validate(fexe); } }); return result[0]; } catch (Exception e) { return FormValidation.error(e, "Should not happen"); } }

Target:
public static FormValidation validateExecutable(String exe, FileValidator exeValidator) { if(!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) return ok(); final FormValidation[] result = {null}; try { DOSToUnixPathHelper.iteratePath(exe, new DOSToUnixPathHelper.Helper() { @Override public void ok() { result[0] = FormValidation.ok(); } @Override public void checkExecutable(File fexe) { result[0] = exeValidator.validate(fexe); } @Override public void error(String string) { result[0] = FormValidation.error(string); } @Override public void validate(File fexe) { result[0] = exeValidator.validate(fexe); } }); return result[0]; } catch (Exception e) { return FormValidation.error(e, "Unexpected error"); } }
Source:
public void accept(Map<String, Object> fieldMap) { boolean alreadyExist = false; Field schemaIdField = getSchemaFieldMap().get(getIdField()); String idFieldName = schemaIdField.getName().getPrefixedName(); Object rawId = fieldMap.get(idFieldName); if (rawId != null) { DocumentModel dm = session.getEntry(String.valueOf(rawId)); if (dm != null) { alreadyExist = true; switch (dataLoadingPolicy) { case IGNORE_DUPLICATE: return; case ERROR_ON_DUPLICATE: throw new DirectoryException(String.format("Entry with id %s already exists in directory %s", dm.getId(), getName())); case UPDATE_DUPLICATE: fieldMap.forEach((fieldName, value) -> dm.setProperty(getSchema(), fieldName, value)); ((BaseSession) session).updateEntryWithoutReferences(dm); break; default: throw new IllegalStateException("Unexpected value: " + dataLoadingPolicy); } } } if (!alreadyExist) { ((BaseSession) session).createEntryWithoutReferences(fieldMap); } }

Target:
public void accept(Map<String, Object> fieldMap) { if (DATA_LOADING_POLICY_REJECT_DUPLICATE.equals(dataLoadingPolicy) || DATA_LOADING_POLICY_LEGACY.equals(dataLoadingPolicy)) { ((BaseSession) session).createEntryWithoutReferences(fieldMap); } else { Object rawId = fieldMap.get(session.getIdField()); if (rawId == null) { throw new DirectoryException("A line is missing the entry id", SC_BAD_REQUEST); } String idValue = String.valueOf(rawId); if (session.hasEntry(idValue)) { if (DATA_LOADING_POLICY_UPDATE_DUPLICATE.equals(dataLoadingPolicy)) { DocumentModel dm = session.getEntry(idValue); fieldMap.forEach((fieldName, value) -> dm.setProperty(schema, fieldName, value)); ((BaseSession) session).updateEntryWithoutReferences(dm); } else { log.debug("Skip the entry with id: {}", idValue); } } else { ((BaseSession) session).createEntryWithoutReferences(fieldMap); } } }
Source:
public Integer getAffectedNodeCount() { if (m_relatedAlarms == null || m_relatedAlarms.isEmpty()) { return 1; } Set<Integer> nodes = m_relatedAlarms.stream().map(OnmsAlarm::getNode).filter(Objects::nonNull).map(OnmsNode::getId).collect(Collectors.toSet()); if (m_node != null) { nodes.add(m_node.getId()); } return nodes.size(); }

Target:
public Integer getAffectedNodeCount() { if (m_relatedAlarms == null || m_relatedAlarms.isEmpty()) { return m_node == null ? 0 : 1; } Set<Integer> nodes = m_relatedAlarms.stream().map(OnmsAlarm::getNode).filter(Objects::nonNull).map(OnmsNode::getId).collect(Collectors.toSet()); if (m_node != null) { nodes.add(m_node.getId()); } return nodes.size(); }
Source:
void openInventory(Inventory inventory, Cause cause) throws IllegalArgumentException; void closeInventory(Cause cause) throws IllegalArgumentException; boolean isViewingGui(); Optional<Gui> getOpenGui(); boolean closeCurrentGui(); boolean showGui(Gui gui); int getViewDistance(); ChatVisibility getChatVisibility(); boolean isChatColorsEnabled(); Set<SkinPart> getDisplayedSkinParts(); @Override PlayerConnection getConnection(); void sendResourcePack(ResourcePack pack); TabList getTabList(); void kick(); void kick(Text reason); Scoreboard getScoreboard(); void setScoreboard(Scoreboard scoreboard); default JoinData getJoinData() { return get(JoinData.class).get(); }

Target:
Optional<Container> openInventory(Inventory inventory, Cause cause) throws IllegalArgumentException; boolean closeInventory(Cause cause) throws IllegalArgumentException; Optional<Window> getActiveWindow(); default void closeActiveWindow() { Optional<Window> active = getActiveWindow(); if (active.isPresent()) { active.get().close(this); } }
Source:
public OAuth2TokenValidatorResult validate(Jwt idToken) { oAuth2Errors = validateRequiredClaims(idToken); if (!oAuth2Errors.isEmpty()){ return OAuth2TokenValidatorResult.failure(oAuth2Errors); } if (!idToken.getAudience().contains(this.clientRegistration.getClientId())) { oAuth2Errors.add(invalidIdTokenError("Audience(au) claim must contain the client_id value")); } String authorizedParty = idToken.getClaimAsString(IdTokenClaimNames.AZP); if (idToken.getAudience().size() > 1 && authorizedParty == null) { oAuth2Errors.add(invalidIdTokenError("With multiple Audiences(aud), Authorized Party(azp) claim must be present")); } if (authorizedParty != null && !authorizedParty.equals(this.clientRegistration.getClientId())) { oAuth2Errors.add(invalidIdTokenError("With Authorized Party(azp) claim present, its value must match client_id")); } Instant now = Instant.now(); if (!now.isBefore(idToken.getExpiresAt())) { oAuth2Errors.add(invalidIdTokenError("Expiration(exp) claim cannot be before current time")); } Instant maxIssuedAt = now.plusSeconds(30); if (idToken.getIssuedAt().isAfter(maxIssuedAt)) { oAuth2Errors.add(invalidIdTokenError("The Issued At(iat) claim cannot be too far away from the current time")); } if (!oAuth2Errors.isEmpty()) { return OAuth2TokenValidatorResult.failure(oAuth2Errors); } return OAuth2TokenValidatorResult.success(); }

Target:
public OAuth2TokenValidatorResult validate(Jwt idToken) { Map<String, Object> invalidClaims = validateRequiredClaims(idToken); if (!invalidClaims.isEmpty()){ return OAuth2TokenValidatorResult.failure(invalidIdToken(invalidClaims)); } if (!idToken.getAudience().contains(this.clientRegistration.getClientId())) { invalidClaims.put(IdTokenClaimNames.AUD, idToken.getAudience()); } String authorizedParty = idToken.getClaimAsString(IdTokenClaimNames.AZP); if (idToken.getAudience().size() > 1 && authorizedParty == null) { invalidClaims.put(IdTokenClaimNames.AZP, authorizedParty); } if (authorizedParty != null && !authorizedParty.equals(this.clientRegistration.getClientId())) { invalidClaims.put(IdTokenClaimNames.AZP, authorizedParty); } Instant now = Instant.now(); if (!now.isBefore(idToken.getExpiresAt())) { invalidClaims.put(IdTokenClaimNames.EXP, idToken.getExpiresAt()); } Instant maxIssuedAt = now.plusSeconds(30); if (idToken.getIssuedAt().isAfter(maxIssuedAt)) { invalidClaims.put(IdTokenClaimNames.IAT, idToken.getIssuedAt()); } if (!invalidClaims.isEmpty()) { return OAuth2TokenValidatorResult.failure(invalidIdToken(invalidClaims)); } return OAuth2TokenValidatorResult.success(); }
Source:
public void forceInsert_pickWinnerOfConflicts_TwoOfSameRoot_OneDeleted() throws Exception { DocumentRevision rev1a = createDbObject("1-x", bodyOne); DocumentRevision rev1b = createDbObject("1-x", bodyTwo); DocumentRevision rev2 = createDbObjectDeleted("2-x"); datastore.forceInsert(rev1a, "1-x"); datastore.forceInsert(rev1b, "1-x"); datastore.forceInsert(rev2, "1-x", "2-x"); DocumentRevision doc = datastore.getDocument(OBJECT_ID); Assert.assertEquals("The document winner should be the expected revision", "1-x", doc .getRevision()); Assert.assertEquals("The document winner should have the expected body", bodyTwo.asMap(), doc.getBody().asMap()); }

Target:
public void forceInsert_pickWinnerOfConflicts_TwoOfSameRoot_OneDeleted() throws Exception { DocumentRevision rev1a = createDbObject("1-x", bodyOne); DocumentRevision rev2 = createDbObjectDeleted("2-x"); datastore.forceInsert(rev1a, "1-x"); datastore.runOnDbQueue(new SQLQueueCallable<Long>() { @Override public Long call(SQLDatabase db) throws Exception { ContentValues args = new ContentValues(); args.put("doc_id", 1l); args.put("revid", "1-x"); args.put("json", bodyTwo.asBytes()); return db.insert("revs", args); } }); datastore.forceInsert(rev2, "1-x", "2-x"); DocumentRevision doc = datastore.getDocument(OBJECT_ID); Assert.assertEquals("The document winner should be the expected revision", "1-x", doc .getRevision()); Assert.assertEquals("The document winner should have the expected body", bodyTwo.asMap(), doc.getBody().asMap()); }
Source:
private void checkProfileVersion(Match match) throws ProfileDefinitionException { EObject left = match.getLeft(); EObject right = match.getRight(); if (left instanceof ProfileApplication && right != null) { Collection<Match> annotationsMatches = Collections2.filter(match.getSubmatches(), ANNOTATION_REFERENCING_PROFILE_DEFINITION); for (Match annotationMatch : annotationsMatches) { EAnnotation leftAnnot = (EAnnotation)annotationMatch.getLeft(); EAnnotation rightAnnot = (EAnnotation)annotationMatch.getRight(); Collection<URI> leftUris = getURIs(ReferenceUtil.getAsList(leftAnnot, EcorePackage.Literals.EANNOTATION__REFERENCES)); Collection<URI> rightUris = getURIs(ReferenceUtil.getAsList(rightAnnot, EcorePackage.Literals.EANNOTATION__REFERENCES)); if (leftUris.size() != rightUris.size() || !leftUris.containsAll(rightUris)) { org.eclipse.uml2.uml.Package impactedPackage = ((ProfileApplication)left) .getApplyingPackage(); String message; if (impactedPackage != null) { message = UMLCompareMessages.getString("profile.definition.changed.on", "<" + impactedPackage.eClass().getName() + "> " + impactedPackage.getName()); } else { message = UMLCompareMessages.getString("profile.definition.changed"); } addDiagnostic(match.getComparison(), new BasicDiagnostic(Diagnostic.ERROR, null, 0, message, new Object[] {})); throw new ProfileDefinitionException(); } } } }

Target:
private boolean checkProfileVersion(Match match) { EObject left = match.getLeft(); EObject right = match.getRight(); if (left instanceof ProfileApplication && right != null) { Collection<Match> annotationsMatches = Collections2.filter(match.getSubmatches(), ANNOTATION_REFERENCING_PROFILE_DEFINITION); for (Match annotationMatch : annotationsMatches) { EAnnotation leftAnnot = (EAnnotation)annotationMatch.getLeft(); EAnnotation rightAnnot = (EAnnotation)annotationMatch.getRight(); if (!checkProfileVersion(match.getComparison(), (ProfileApplication)left, leftAnnot, rightAnnot)) { return false; } } } return true; }
Source:
public void handleSetPushSetupSmsResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handleSetPushSetupSmsResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error("Set Push Setup Sms Response not ok. Unexpected Exception", exception); result = ResponseMessageResultType.NOT_OK; } this.webServiceResponseMessageSender.send(ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }

Target:
public void handleSetPushSetupSmsResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handleSetPushSetupSmsResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error("Set Push Setup Sms Response not ok. Unexpected Exception", exception); result = ResponseMessageResultType.NOT_OK; } ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send(responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
public void unregisterService(ServiceDescription description) { if (mdnsClient != null) { logger.debug("Unregistering service at port {}", description.serviceType, description.servicePort); mdnsClient.unregisterService(description); } }

Target:
public void unregisterService(ServiceDescription description) { if (mdnsClient != null) { mdnsClient.unregisterService(description); } }
Source:
List<PipelineTemplate> list(@RequestParam(required = false, value = "scopes", defaultValue = "global") List<String> scopes) { if (pipelineTemplateDAO == null) { throw PipelineTemplateFeatureUnsupportedException.build(); } return (List<PipelineTemplate>) pipelineTemplateDAO.getPipelineTemplatesByScope(scopes); }

Target:
List<PipelineTemplate> list(@RequestParam(required = false, value = "scopes", defaultValue = "global") List<String> scopes) { return (List<PipelineTemplate>) getPipelineTemplateDAO().getPipelineTemplatesByScope(scopes); }
Source:
public void enableDiversity() throws KuraException { logger.warn("Not a LTE Modem"); }

Target:
public void enableDiversity() throws KuraException { throw new KuraException(KuraErrorCode.OPERATION_NOT_SUPPORTED); }
Source:
public static BookieSocketAddress getBookieAddress(ServerConfiguration conf) throws UnknownHostException { String iface = conf.getListeningInterface(); if (iface == null) { iface = "default"; } String hostName = DNS.getDefaultHost(iface); InetSocketAddress inetAddr = new InetSocketAddress(hostName, conf.getBookiePort()); if (inetAddr.isUnresolved()) { throw new UnknownHostException("Unable to resolve default hostname: " + hostName + " for interface: " + iface); } String hostAddress = inetAddr.getAddress().getHostAddress(); if (conf.getUseHostNameAsBookieID()) { hostAddress = inetAddr.getAddress().getCanonicalHostName(); } if (conf.getAdvertisedAddress() != null && conf.getAdvertisedAddress().trim().length() > 0) { hostAddress = conf.getAdvertisedAddress().trim(); } BookieSocketAddress addr = new BookieSocketAddress(hostAddress, conf.getBookiePort()); if (addr.getSocketAddress().getAddress().isLoopbackAddress() && !conf.getAllowLoopback()) { throw new UnknownHostException("Trying to listen on loopback address, " + addr + " but this is forbidden by default " + "(see ServerConfiguration#getAllowLoopback())"); } return addr; }

Target:
public static BookieSocketAddress getBookieAddress(ServerConfiguration conf) throws UnknownHostException { if (conf.getAdvertisedAddress() != null && conf.getAdvertisedAddress().trim().length() > 0) { String hostAddress = conf.getAdvertisedAddress().trim(); return new BookieSocketAddress(hostAddress, conf.getBookiePort()); } String iface = conf.getListeningInterface(); if (iface == null) { iface = "default"; } String hostName = DNS.getDefaultHost(iface); InetSocketAddress inetAddr = new InetSocketAddress(hostName, conf.getBookiePort()); if (inetAddr.isUnresolved()) { throw new UnknownHostException("Unable to resolve default hostname: " + hostName + " for interface: " + iface); } String hostAddress = inetAddr.getAddress().getHostAddress(); if (conf.getUseHostNameAsBookieID()) { hostAddress = inetAddr.getAddress().getCanonicalHostName(); } BookieSocketAddress addr = new BookieSocketAddress(hostAddress, conf.getBookiePort()); if (addr.getSocketAddress().getAddress().isLoopbackAddress() && !conf.getAllowLoopback()) { throw new UnknownHostException("Trying to listen on loopback address, " + addr + " but this is forbidden by default " + "(see ServerConfiguration#getAllowLoopback())"); } return addr; }
Source:
private InstantiationException multipleMatchingConstructors(Class<?> cls, List<Constructor<?>> constructors) { return new InstantiationException(join("Unable to create instance of '" + cls.getSimpleName() + "'.", "Multiple constructors could be matched to arguments of types " + constructorArgTypes() + ":", join("", " - ", constructors) ), null); }

Target:
private InstantiationException multipleMatchingConstructors(Class<?> cls, List<Constructor<?>> constructors) { return new InstantiationException(join("Unable to create instance of '" + cls.getSimpleName() + "'.", "Multiple constructors could be matched to arguments of types " + constructorArgTypes() + ":", join("", " - ", constructors), "If you believe that Mockito could do a better job deciding on which constructor to use, please let us know.", "Ticket 685 contains the discussion and a workaround for ambiguous constructors using inner class.", "See <LINK_0>" ), null); }
Source:
protected boolean generateXML(AccountingXmlDocumentListWrapper documentWrapper, String masterAccountName) { boolean success = true; String fileNameBase = configurationService.getPropertyValueAsString(CuFPKeyConstants.AWS_BILLING_SERVICE_OUTPUT_FILE_NAME_FORMAT); String fileName = MessageFormat.format(fileNameBase, directoryPath, findProcessYear(), findMonthName(), masterAccountName, Calendar.getInstance().getTime().getTime()); try { cuMarshalService.marshalObjectToXML(documentWrapper, fileName); fileStorageService.createDoneFile(fileName); LOG.info("generateXML, successfully created an XML and DONE file for " + fileName); } catch (JAXBException | IOException e) { success = false; LOG.error("generateDistributionOfIncomeDocumentsFromAWSService, unable to marshal documentWrapper to " + fileName, e); } return success; }

Target:
protected boolean generateXML(AccountingXmlDocumentListWrapper documentWrapper, String masterAccountName) { boolean success = true; String fileNameBase = configurationService.getPropertyValueAsString(CuFPKeyConstants.AWS_BILLING_SERVICE_OUTPUT_FILE_NAME_FORMAT); String fileName = MessageFormat.format(fileNameBase, directoryPath, findProcessYear(), findMonthName(), masterAccountName, Calendar.getInstance().getTime().getTime()); try { cuMarshalService.marshalObjectToXML(documentWrapper, fileName); fileStorageService.createDoneFile(fileName); LOG.info("generateXML, successfully created an XML and DONE file for " + fileName); } catch (JAXBException | IOException e) { success = false; LOG.error("generateXML, unable to marshal documentWrapper to " + fileName, e); } return success; }
Source:
private Buffer.DataType getNextDataType(BufferAndBacklog bufferAndBacklog) { final Buffer.DataType nextDataType = bufferAndBacklog.getNextDataType(); if (numCreditsAvailable > 0 || (nextDataType != null && nextDataType.isEvent())) { return nextDataType; } return null; }

Target:
private Buffer.DataType getNextDataType(BufferAndBacklog bufferAndBacklog) { final Buffer.DataType nextDataType = bufferAndBacklog.getNextDataType(); if (numCreditsAvailable > 0 || nextDataType.isEvent()) { return nextDataType; } return Buffer.DataType.NONE; }
Source:
public ValidationResult validateDeletion(KitDescriptor object) throws IOException { ValidationResult result = new ValidationResult(); switch (object.getKitType()) { case LIBRARY: long libUsage = kitStore.getUsageByLibraries(object); if (libUsage > 0) { result.addError(ValidationError.forDeletionUsage(object, libUsage, Pluralizer.libraries(libUsage))); } break; case CLUSTERING: case MULTIPLEXING: long containerUsage = kitStore.getUsageByContainers(object); if (containerUsage > 0) { result.addError(ValidationError.forDeletionUsage(object, containerUsage, "sequencing " + Pluralizer.containers(containerUsage))); } break; default: break; } return result; }

Target:
public ValidationResult validateDeletion(KitDescriptor object) throws IOException { ValidationResult result = new ValidationResult(); long libUsage = kitStore.getUsageByLibraries(object); if (libUsage > 0) { result.addError(ValidationError.forDeletionUsage(object, libUsage, Pluralizer.libraries(libUsage))); } long containerUsage = kitStore.getUsageByContainers(object); if (containerUsage > 0) { result.addError(ValidationError.forDeletionUsage(object, containerUsage, "sequencing " + Pluralizer.containers(containerUsage))); } return result; }
Source:
private void validateCreation(EnvironmentCreationDto creationDto, Environment environment) { LOGGER.info("Validating environment creation. CreationDto: '{}', Environment: '{}'.", creationDto, environment); ValidationResultBuilder validationBuilder = validatorService.validateNetworkCreation(environment, creationDto.getNetwork()); ValidationResult parentChildValidation = validatorService.validateParentChildRelation(environment, creationDto.getParentEnvironmentName()); validationBuilder.merge(parentChildValidation); validationBuilder.ifError(() -> isCloudPlatformInvalid(creationDto.getCreator(), creationDto.getCloudPlatform()), "Provisioning in Microsoft Azure is not enabled for this account."); ValidationResult freeIpaCreationValidation = validatorService.validateFreeIpaCreation(creationDto.getFreeIpaCreation()); validationBuilder.merge(freeIpaCreationValidation); ValidationResult validationResult = validationBuilder.build(); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } }

Target:
private void validateCreation(EnvironmentCreationDto creationDto, Environment environment) { LOGGER.info("Validating environment creation. CreationDto: '{}', Environment: '{}'.", creationDto, environment); ValidationResultBuilder validationBuilder = validatorService.validateNetworkCreation(environment, creationDto.getNetwork()); ValidationResult parentChildValidation = validatorService.validateParentChildRelation(environment, creationDto.getParentEnvironmentName()); validationBuilder.merge(parentChildValidation); validationBuilder.ifError(() -> isCloudPlatformInvalid(creationDto.getCreator(), creationDto.getCloudPlatform()), "Provisioning in " + creationDto.getCloudPlatform() + " is not enabled for this account."); ValidationResult freeIpaCreationValidation = validatorService.validateFreeIpaCreation(creationDto.getFreeIpaCreation()); validationBuilder.merge(freeIpaCreationValidation); ValidationResult validationResult = validationBuilder.build(); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } }
Source:
public static DenseLayer buildDenseLayer(Map<String,Object> kerasConfig) throws NotImplementedException { DenseLayer.Builder builder = new DenseLayer.Builder() .nOut((int)kerasConfig.get("output_dim")); finishLayerConfig(builder, kerasConfig); return builder.build(); }

Target:
public static DenseLayer buildDenseLayer(Map<String,Object> kerasConfig) throws NotImplementedException { DenseLayer.Builder builder = new DenseLayer.Builder() .nOut((int)kerasConfig.get(KERAS_LAYER_PROPERTY_OUTPUT_DIM)); finishLayerConfig(builder, kerasConfig); return builder.build(); }
Source:
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); final String name = address.getLastElement().getValue(); final ModelNode bufferSizeModel = BufferPoolResourceDefinition.BUFFER_SIZE.resolveModelAttribute(context, model); final ModelNode bufferPerSliceModel = BufferPoolResourceDefinition.BUFFER_PER_SLICE.resolveModelAttribute(context, model); final ModelNode directModel = BufferPoolResourceDefinition.DIRECT_BUFFERS.resolveModelAttribute(context, model); final int bufferSize = bufferSizeModel.isDefined() ? bufferSizeModel.asInt() : BufferPoolResourceDefinition.defaultBufferSize; final int bufferPerSlice = bufferPerSliceModel.isDefined() ? bufferPerSliceModel.asInt() : BufferPoolResourceDefinition.defaultBuffersPerRegion; final boolean direct = directModel.isDefined() ? directModel.asBoolean() : BufferPoolResourceDefinition.defaultDirectBuffers; final BufferPoolService service = new BufferPoolService(bufferSize, bufferPerSlice, direct); context.getServiceTarget().addService(IOServices.BUFFER_POOL.append(name), service) .setInitialMode(ServiceController.Mode.ACTIVE).install(); }

Target:
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); final String name = address.getLastElement().getValue(); final ModelNode bufferSizeModel = BufferPoolResourceDefinition.BUFFER_SIZE.resolveModelAttribute(context, model); final ModelNode bufferPerSliceModel = BufferPoolResourceDefinition.BUFFER_PER_SLICE.resolveModelAttribute(context, model); final ModelNode directModel = BufferPoolResourceDefinition.DIRECT_BUFFERS.resolveModelAttribute(context, model); final int bufferSize = bufferSizeModel.isDefined() ? bufferSizeModel.asInt() : BufferPoolResourceDefinition.defaultBufferSize; final int bufferPerSlice = bufferPerSliceModel.isDefined() ? bufferPerSliceModel.asInt() : BufferPoolResourceDefinition.defaultBuffersPerRegion; final boolean direct = directModel.isDefined() ? directModel.asBoolean() : BufferPoolResourceDefinition.defaultDirectBuffers; final BufferPoolService service = new BufferPoolService(bufferSize, bufferPerSlice, direct); context.getCapabilityServiceTarget().addCapability(BufferPoolResourceDefinition.IO_POOL_RUNTIME_CAPABILITY, service) .setInitialMode(ServiceController.Mode.ON_DEMAND) .install(); ByteBufferPoolService poolService = new ByteBufferPoolService(); context.getCapabilityServiceTarget().addCapability(BufferPoolResourceDefinition.IO_BYTE_BUFFER_POOL_RUNTIME_CAPABILITY, poolService) .addCapabilityRequirement(BufferPoolResourceDefinition.IO_POOL_RUNTIME_CAPABILITY.getDynamicName(address), Pool.class, poolService.bufferPool) .setInitialMode(ServiceController.Mode.ON_DEMAND) .install(); }
Source:
private void setRGBAColor(String color) { String hexColor; if(color != null && X11ColorUtils.toHexColor(color) != null) { hexColor = X11ColorUtils.toHexColor(color); hexColor = hexColor.substring(1); } else { hexColor = DEFAULT_COLOR; } int intColor = Integer.parseInt(hexColor, HEX); RGBAColor rgbaColor = new RGBAColor(intColor); fRGBAColor = new RGBA(rgbaColor.getRed(), rgbaColor.getBlue(), rgbaColor.getGreen(), ALPHA); }

Target:
private void setRGBAColor(String color) { String hexColor = color; if (hexColor != null && (hexColor = X11ColorUtils.toHexColor(hexColor)) != null) { hexColor = hexColor.substring(1); } else { hexColor = DEFAULT_COLOR; } int intColor = Integer.parseInt(hexColor, HEX); RGBAColor rgbaColor = new RGBAColor(intColor); fRGBAColor = new RGBA(rgbaColor.getRed(), rgbaColor.getGreen(), rgbaColor.getBlue(), ALPHA); }
Source:
public CellWithElementId<C> getCell() { return (CellWithElementId<C>) getCell(); }

Target:
public CellWithElementId<C> getCell() { return (CellWithElementId<C>) super.getCell(); }
Source:
private boolean validateAddressIfCheckPayment(ConcurRequestExtractRequestDetailFileLine detailFileLine) { boolean valid = true; String employeeId = detailFileLine.getEmployeeId(); if (getConcurPersonValidationService().isPayeeSignedUpForACH(employeeId)) { LOG.info("validateAddressIfCheckPayment, the employee ID " + employeeId + " is signed up for ACH so no need to validdate address."); } else { valid = getConcurPersonValidationService().validPdpAddress(employeeId); if (!valid) { detailFileLine.getValidationResult().addMessage(getConfigurationService().getPropertyValueAsString(ConcurKeyConstants.CONCUR_INCOMPLETE_ADDRESS)); } LOG.info("validateAddressIfCheckPayment, Is the address valid: " + valid); } return valid; }

Target:
private boolean validateAddressIfCheckPayment(ConcurRequestExtractRequestDetailFileLine detailFileLine) { boolean valid = true; String validationMessage = getConcurEmployeeInfoValidationService().getAddressValidationMessageIfCheckPayment(detailFileLine.getEmployeeId()); if (StringUtils.isNotBlank(validationMessage)) { valid = false; detailFileLine.getValidationResult().addMessage(validationMessage); } return valid; }
Source:
public static Datum createFromInt8(DataType type, long val) { switch (type.getType()) { case INT8: return new Int8Datum(val); case TIMESTAMP: return new TimestampDatum(val); case TIME: return createTime(val); default: throw new TajoRuntimeException(Errors.ResultCode.UNSUPPORTED_DATATYPE, type.getType().name()); } }

Target:
public static Datum createFromInt8(DataType type, long val) { switch (type.getType()) { case INT8: return new Int8Datum(val); case TIMESTAMP: return new TimestampDatum(val); case TIME: return createTime(val); default: throw new TajoRuntimeException(new UnsupportedDataTypeException(type.getType().name())); } }