auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Map<String, Ref> getRemoteRefs() throws IOException { Map<String, Ref> matches = new HashMap<String, Ref>(); RefDatabase rdb = repository.getRefDatabase(); for (RefSpec spec : getSubscribeSpecs()) { String remoteRef; boolean isTag = spec.getSource().startsWith(Constants.R_TAGS); if (isTag) remoteRef = spec.getSource(); else remoteRef = getRemoteRefFromLocal(remote, spec.getSource()); Collection<Ref> c; if (spec.isWildcard()) { remoteRef = remoteRef.substring(0, remoteRef.length() - 1); c = rdb.getRefs(remoteRef).values(); } else { Ref r = rdb.getRef(remoteRef); if (r == null) continue; c = Collections.nCopies(1, r); } for (Ref r : c) { if (isTag) matches.put(r.getName(), r); else matches.put(getLocalRefFromRemote(getRemote(), r.getName()), r); } } return matches; }

Target:
public Map<String, Ref> getRemoteRefs() throws IOException { Map<String, Ref> matches = new HashMap<String, Ref>(); RefDatabase rdb = repository.getRefDatabase(); for (RefSpec spec : getSubscribeSpecs()) { String remoteRef; boolean isTag = spec.getSource().startsWith(Constants.R_TAGS); if (isTag) remoteRef = spec.getSource(); else remoteRef = getRemoteRefFromLocal(remote, spec.getSource()); Collection<Ref> c; if (spec.isWildcard()) { remoteRef = remoteRef.substring(0, remoteRef.length() - 1); c = rdb.getRefs(remoteRef).values(); } else { Ref r = rdb.getRef(remoteRef); if (r == null) continue; c = Collections.singleton(r); } for (Ref r : c) { if (isTag) matches.put(r.getName(), r); else matches.put(getLocalRefFromRemote(getRemote(), r.getName()), r); } } return matches; }
Source:
public void onStreamDestroy(IMediaStream stream) { }

Target:
public void onStreamDestroy(IMediaStream stream) { PacketListener listener = null; String streamName = stream.getName(); WMSProperties props = stream.getProperties(); synchronized (props) { listener = (PacketListener) props.get(STREAM_ACTION_LISTENER_PROPERTY); } if (listener != null) { stream.removeLivePacketListener(listener); String entryId = Utils.getEntryIdFromStreamName(streamName); this.removeGlobalPTSSyncData(entryId); logger.info("remove PacketListener: " + stream.getSrc()); } }
Source:
protected Object parseValue(CommandSource source, CommandArgs args) throws ArgumentParseException { Object state = args.getState(); try { return this.possiblePlayer.parseValue(source, args); } catch (ArgumentParseException ex) { args.setState(state); try { return super.parseValue(source, args); } catch (ArgumentParseException ex2) { if (returnSource && source instanceof User) return source; else throw ex2; } } }

Target:
protected Object parseValue(CommandSource source, CommandArgs args) throws ArgumentParseException { Object state = args.getState(); try { return this.possiblePlayer.parseValue(source, args); } catch (ArgumentParseException ex) { args.setState(state); try { return super.parseValue(source, args); } catch (ArgumentParseException ex2) { if (this.returnSource && source instanceof User) { return source; } else { throw ex2; } } } }
Source:
private static void setMaxAttributeSizeProperty(XMLInputFactory factory) { String maxAttributeSizeProperty = getProperty(MULE_MAX_ATTRIBUTE_SIZE); if(maxAttributeSizeProperty != null) { Integer maxAttributeSize = parseInt(maxAttributeSizeProperty); if(maxAttributeSize > 0) { factory.setProperty(P_MAX_ATTRIBUTE_SIZE, maxAttributeSizeProperty); return; } else if (LOGGER.isDebugEnabled()) { LOGGER.debug("Invalid " + P_MAX_ATTRIBUTE_SIZE + " property value"); } } factory.setProperty(P_MAX_ATTRIBUTE_SIZE, MAX_VALUE); }

Target:
private static void setMaxAttributeSizeProperty(XMLInputFactory factory) { String maxAttributeSizeProperty = getProperty(MULE_MAX_ATTRIBUTE_SIZE); if(maxAttributeSizeProperty != null) { Integer maxAttributeSize = parseInt(maxAttributeSizeProperty); if(maxAttributeSize > 0) { factory.setProperty(P_MAX_ATTRIBUTE_SIZE, maxAttributeSizeProperty); return; } else { LOGGER.warn("Invalid " + P_MAX_ATTRIBUTE_SIZE + " property value"); } } factory.setProperty(P_MAX_ATTRIBUTE_SIZE, MAX_VALUE); }
Source:
public TestSetRunListener( ConsoleReporter consoleReporter, FileReporter fileReporter, StatelessXmlReporter simpleXMLReporter, TestcycleConsoleOutputReceiver consoleOutputReceiver, StatisticsReporter statisticsReporter, boolean trimStackTrace, boolean isPlainFormat, boolean briefOrPlainFormat ) { this.consoleReporter = consoleReporter != null ? consoleReporter : new NullConsoleReporter(); this.fileReporter = fileReporter; this.statisticsReporter = statisticsReporter; this.simpleXMLReporter = simpleXMLReporter; this.consoleOutputReceiver = consoleOutputReceiver; this.briefOrPlainFormat = briefOrPlainFormat; detailsForThis = new TestSetStats( trimStackTrace, isPlainFormat ); testMethodStats = new ArrayList<TestMethodStats>(); }

Target:
public TestSetRunListener( ConsoleReporter consoleReporter, FileReporter fileReporter, StatelessXmlReporter simpleXMLReporter, TestcycleConsoleOutputReceiver consoleOutputReceiver, StatisticsReporter statisticsReporter, boolean trimStackTrace, boolean isPlainFormat, boolean briefOrPlainFormat ) { this.consoleReporter = consoleReporter; this.fileReporter = fileReporter; this.statisticsReporter = statisticsReporter; this.simpleXMLReporter = simpleXMLReporter; this.consoleOutputReceiver = consoleOutputReceiver; this.briefOrPlainFormat = briefOrPlainFormat; detailsForThis = new TestSetStats( trimStackTrace, isPlainFormat ); testMethodStats = new ArrayList<TestMethodStats>(); }
Source:
private void makeFiltersModifiable() { if ( !filtersCanBeModified) { this.filtersCanBeModified = true; if (filters == null) { this.filters = new HashSet<>(); } else { this.filters = new HashSet<>(filters); } } }

Target:
private void makeFiltersModifiable() { if (!filtersCanBeModified) { this.filtersCanBeModified = true; final Set<String> tempFilters = filters; this.filters = new HashSet<>(); if (tempFilters != null) { this.filters.addAll(tempFilters); } } }
Source:
public Object execute() throws Exception { System.out.printf("%s=%s%n", "Protocol", SystemBaseUrl.EXTERNAL.getProtocol()); System.out.printf("%s=%s%n", "Host", SystemBaseUrl.EXTERNAL.getHost()); System.out.printf("%s=%s%n", "Port", SystemBaseUrl.EXTERNAL.getPort()); System.out.printf("%s=%s%n", "Root Context", SystemBaseUrl.EXTERNAL.getRootContext()); System.out.printf("%s=%s%n", "External Http Port", SystemBaseUrl.EXTERNAL.getHttpPort()); System.out.printf("%s=%s%n", "External Https Port", SystemBaseUrl.EXTERNAL.getHttpsPort()); System.out.printf( "%s=%s%n", "Internal Http Port", System.getProperty(SystemBaseUrl.INTERNAL.getHttpPort())); System.out.printf( "%s=%s%n", "Internal Https Port", System.getProperty(SystemBaseUrl.INTERNAL.getHttpsPort())); System.out.printf("%s=%s%n", "Site Name", SystemInfo.getSiteName()); System.out.printf("%s=%s%n", "Organization", SystemInfo.getOrganization()); System.out.printf("%s=%s%n", "Contact", SystemInfo.getSiteContatct()); System.out.printf("%s=%s%n", "Version", SystemInfo.getVersion()); return null; }

Target:
public Object execute() throws Exception { System.out.printf("%s=%s%n", "Protocol", SystemBaseUrl.EXTERNAL.getProtocol()); System.out.printf("%s=%s%n", "Host", SystemBaseUrl.EXTERNAL.getHost()); System.out.printf("%s=%s%n", "Port", SystemBaseUrl.EXTERNAL.getPort()); System.out.printf("%s=%s%n", "Root Context", SystemBaseUrl.EXTERNAL.getRootContext()); System.out.printf("%s=%s%n", "External Http Port", SystemBaseUrl.EXTERNAL.getHttpPort()); System.out.printf("%s=%s%n", "External Https Port", SystemBaseUrl.EXTERNAL.getHttpsPort()); System.out.printf( "%s=%s%n", "Internal Http Port", System.getProperty(SystemBaseUrl.INTERNAL.getHttpPort())); System.out.printf( "%s=%s%n", "Internal Https Port", System.getProperty(SystemBaseUrl.INTERNAL.getHttpsPort())); System.out.printf("%s=%s%n", "Internal Protocol", SystemBaseUrl.INTERNAL.getProtocol()); System.out.printf("%s=%s%n", "Internal Host", SystemBaseUrl.INTERNAL.getHost()); System.out.printf("%s=%s%n", "Internal Port", SystemBaseUrl.INTERNAL.getPort()); System.out.printf("%s=%s%n", "Site Name", SystemInfo.getSiteName()); System.out.printf("%s=%s%n", "Organization", SystemInfo.getOrganization()); System.out.printf("%s=%s%n", "Contact", SystemInfo.getSiteContatct()); System.out.printf("%s=%s%n", "Version", SystemInfo.getVersion()); return null; }
Source:
public static <E> void setView(Configuration conf, View<E> view) { if (view instanceof AbstractRefinableView) { conf.set(KITE_CONSTRAINTS, serialize((AbstractRefinableView) view)); } }

Target:
public static <E> void setView(Configuration conf, View<E> view) { if (view instanceof AbstractRefinableView) { conf.set(KITE_CONSTRAINTS, serialize(((AbstractRefinableView) view).getConstraints())); } else { throw new UnsupportedOperationException("Implementation " + "does not provide InputFormat support. View: " + view); } }
Source:
public SharedSegment getHostSharedSegment(String mac) { LOG.debug("getHostNodeSharedSegment: founding segment for mac:{}", mac); final List<BridgeMacLink> links = new ArrayList<BridgeMacLink>(); m_bridgeMacLinkDao.findByMacAddress(mac). stream(). filter(maclink -> maclink.getLinkType() == BridgeMacLinkType.BRIDGE_LINK) .forEach(maclink -> { links.add(maclink); }); if (links.size() == 0 ) { LOG.info("getHostNodeSharedSegment: no segment found for mac:{}", mac); return SharedSegment.create(); } if (links.size() > 1 ) { LOG.error("getHostNodeSharedSegment: more then one segment for mac:{}", mac); return SharedSegment.create(); } BridgeMacLink link = links.iterator().next(); SharedSegment segment = null; try { for (BridgeBridgeLink bblink: m_bridgeBridgeLinkDao.getByDesignatedNodeIdBridgePort(link.getNode().getId(), link.getBridgePort())) { if (segment == null) { segment = SharedSegment.create(bblink); } else { segment.getBridgePortsOnSegment().add(BridgePort.getFromBridgeBridgeLink(bblink)); } } for (BridgeMacLink maclink :m_bridgeMacLinkDao.findByNodeIdBridgePort(link.getNode().getId(), link.getBridgePort())) { if (segment == null) { segment = SharedSegment.create(maclink); } else { segment.getMacsOnSegment().add(maclink.getMacAddress()); } } } catch (Exception e) { LOG.error("getHostNodeSharedSegment: cannot create shared segment for mac ", e.getMessage(), mac,e); return SharedSegment.create(); } return segment; }

Target:
public SharedSegment getHostSharedSegment(String mac) { LOG.debug("getHostNodeSharedSegment: founding segment for mac:{}", mac); final List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac). stream(). filter(maclink -> maclink.getLinkType() == BridgeMacLinkType.BRIDGE_LINK). collect(Collectors.toCollection(ArrayList::new)); if (links.size() == 0 ) { LOG.info("getHostNodeSharedSegment: no segment found for mac:{}", mac); return SharedSegment.create(); } if (links.size() > 1 ) { LOG.error("getHostNodeSharedSegment: more then one segment for mac:{}", mac); return SharedSegment.create(); } BridgeMacLink link = links.iterator().next(); SharedSegment segment = null; try { for (BridgeBridgeLink bblink: m_bridgeBridgeLinkDao.getByDesignatedNodeIdBridgePort(link.getNode().getId(), link.getBridgePort())) { if (segment == null) { segment = SharedSegment.create(bblink); } else { segment.getBridgePortsOnSegment().add(BridgePort.getFromBridgeBridgeLink(bblink)); } } for (BridgeMacLink maclink :m_bridgeMacLinkDao.findByNodeIdBridgePort(link.getNode().getId(), link.getBridgePort())) { if (segment == null) { segment = SharedSegment.create(maclink); } else { segment.getMacsOnSegment().add(maclink.getMacAddress()); } } } catch (Exception e) { LOG.error("getHostNodeSharedSegment: cannot create shared segment for mac ", e.getMessage(), mac,e); return SharedSegment.create(); } return segment; }
Source:
protected Object doExecute() throws Exception { File destFile = new File(karafConfigPath + "overlord.properties"); if (destFile.exists()) { commonActions(); System.out.println(Messages.getString("overlord.configure.password.previous.installation")); return null; } else if (StringUtils.isBlank(adminPassword)) { throw new RuntimeException(Messages.getString("overlord.configure.password.required.first.install")); } else { commonActions(); ChangePasswordCommand passwordCommand = new ChangePasswordCommand(); passwordCommand.setCreationAllowed(true); passwordCommand.setBundleContext(bundleContext); passwordCommand.setPassword(adminPassword); passwordCommand.execute(session); } return null; }

Target:
protected Object doExecute() throws Exception { File destFile = new File(karafConfigPath + "overlord.properties"); logger.info(Messages.getString("overlord.configure.execution")); if (destFile.exists()) { String message = Messages.getString("overlord.configure.password.previous.installation"); System.out.println(message); logger.info(message); return null; } else if (StringUtils.isBlank(password)) { throw new RuntimeException(Messages.getString("overlord.configure.password.required.first.install")); } else { logger.debug(Messages.getString("overlord.configure.execution.started")); commonActions(); ChangePasswordCommand passwordCommand = new ChangePasswordCommand(); passwordCommand.setCreationAllowed(true); passwordCommand.setBundleContext(bundleContext); passwordCommand.setPassword(password); passwordCommand.execute(session); logger.debug(Messages.getString("overlord.configure.execution.ended")); } return null; }
Source:
@Override public void run() { try { while (!Thread.currentThread().isInterrupted()) { if (notifier.canOutputOperationLogs() && hiveStatement.hasMoreLogs()) { commands.debug("going to print operations logs"); updateQueryLog(); commands.debug("printed operations logs"); } else { Thread.sleep(queryProgressInterval); } } } catch (InterruptedException e) { commands.debug("Getting log thread is interrupted, since query is done!"); } finally { commands.showRemainingLogsIfAny(hiveStatement); } }

Target:
@Override public void run() { try { while (hiveStatement.hasMoreLogs()) { if (notifier.canOutputOperationLogs()) { commands.debug("going to print operations logs"); updateQueryLog(); commands.debug("printed operations logs"); } Thread.sleep(queryProgressInterval); } } catch (InterruptedException e) { commands.debug("Getting log thread is interrupted, since query is done!"); } finally { commands.showRemainingLogsIfAny(hiveStatement); } }
Source:
public void write(Location loc) throws Exception { if (!Session.getInstance().hasDescription()) { annotate("", loc); } }

Target:
public void write(Location loc) throws Exception { annotate("", loc); }
Source:
public <T extends CommandResult> void execute(final Command<T> command, final AsyncCallback<T> callback) { JdbcScheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { Stopwatch stopwatch = Stopwatch.createStarted(); List<CommandResult> results = servlet .handleCommands(Collections .<Command>singletonList(command)); CommandResult result = results.get(0); long elapsedSeconds = stopwatch.elapsed(TimeUnit.SECONDS); if (elapsedSeconds > maximumCommandExecutionTimeInSeconds) { throw new RuntimeException("Command execution takes too long. Takes: " + elapsedSeconds + " seconds, " + ", maximum allowed execution time: " + maximumCommandExecutionTimeInSeconds + " seconds, command: " + command); } else { } if (result instanceof SyncRegionUpdate) { System.out.println(((SyncRegionUpdate) result).getSql()); } if (result instanceof Exception) { throw new Error((Throwable) result); } else { callback.onSuccess((T) result); } } }); JdbcScheduler.get().process(); }

Target:
public <T extends CommandResult> void execute(final Command<T> command, final AsyncCallback<T> callback) { JdbcScheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { Stopwatch stopwatch = Stopwatch.createStarted(); List<CommandResult> results = servlet .handleCommands(Collections .<Command>singletonList(command)); CommandResult result = results.get(0); long elapsedSeconds = stopwatch.elapsed(TimeUnit.SECONDS); if (elapsedSeconds > maximumCommandExecutionTimeInSeconds) { throw new RuntimeException("Command execution takes too long. Takes: " + elapsedSeconds + " seconds, " + ", maximum allowed execution time: " + maximumCommandExecutionTimeInSeconds + " seconds, command: " + command); } if (result instanceof SyncRegionUpdate) { System.out.println(((SyncRegionUpdate) result).getSql()); } if (result instanceof Exception) { throw new Error((Throwable) result); } else { callback.onSuccess((T) result); } } }); JdbcScheduler.get().process(); }
Source:
public JNDIObjectLocatorBuilder clearEnvironment() { if (this.environmentKey != null) { this.environmentKey.clear(); this.environmentValue.clear(); } return this; }

Target:
public JNDIObjectLocatorBuilder clearEnvironment() { if (this.environmentKeys != null) { this.environmentKeys.clear(); this.environmentValues.clear(); } return this; }
Source:
public <T extends RealType<T>> DoubleType mae(final DoubleType out, final IterableInterval<T> reference, final IterableInterval<T> test) { final DoubleType result = (DoubleType) ops().run( net.imagej.ops.image.quality.DefaultMAE.class, out, reference, test); return result; }

Target:
public <T extends RealType<T>> DoubleType mae(final DoubleType out, final IterableInterval<T> reference, final IterableInterval<T> test) { final DoubleType result = (DoubleType) ops().run( net.imagej.ops.Ops.Image.MAE.class, out, reference, test); return result; }
Source:
public void initTable() throws Exception { ts = nextTimestamp(); initATableValues("aTable", tenantId, getDefaultSplits(tenantId), date=new Date(System.currentTimeMillis()), ts, getUrl()); if (indexDDL != null && indexDDL.length() > 0) { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); conn.createStatement().execute(indexDDL); } }

Target:
public void initTable() throws Exception { ts = nextTimestamp(); initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), date=new Date(System.currentTimeMillis()), ts, getUrl()); if (indexDDL != null && indexDDL.length() > 0) { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); conn.createStatement().execute(indexDDL); } }
Source:
public FilterMana getPhyrexianColors() { return this.phyrexianColors.copy(); }

Target:
public FilterMana getPhyrexianColors() { return this.phyrexianColors; }
Source:
private void assertResponseContent(HttpResponseContext responseContext, OutgoingMessage outgoingMessage) { if (outgoingMessage.getBody().equalsIgnoreCase(responseContext.getRequestBody())) { System.out.print("Equal"); } else { System.out.print("Wrong"); } }

Target:
private void assertResponseContent(HttpResponseContext responseContext, OutgoingMessage outgoingMessage) { if (outgoingMessage.getBody().equalsIgnoreCase(responseContext.getRequestBody())) { log.info("Equal"); } else { log.info("Wrong"); } }
Source:
private Diamond3iIterable(Vector3ic origin, int maxDistance) { Preconditions.checkArgument(maxDistance >= 0, "maxDistance must be > 0"); this.origin.set(origin); this.endDistance = maxDistance; }

Target:
private Diamond3iIterable(Vector3ic origin, int maxDistance) { Preconditions.checkArgument(maxDistance >= 0, "maxDistance must be >= 0"); this.origin.set(origin); this.endDistance = maxDistance; }
Source:
public void testCreateTableDefaultCassandraMetadata() throws TException { String keyspace = CASSANDRA.getConfig().getKeyspaceOrThrow(); CfDef expectedCfDef = createDefaultCfDef(keyspace, CASSANDRA_DEFAULT_TABLE_NAME); TableReference tableReference = TableReference.createFromFullyQualifiedName(ATLAS_DEFAULT_TABLE_NAME); keyValueService.createTable(tableReference, AtlasDbConstants.GENERIC_TABLE_METADATA); List<CfDef> cfDefs = ((CassandraKeyValueService) keyValueService).getClientPool() .run(client -> client.describe_keyspace(keyspace).getCf_defs()); CfDef defaultCfDef = cfDefs.stream() .filter(cfDef -> cfDef.name.equals(CASSANDRA_DEFAULT_TABLE_NAME)) .findFirst() .get(); assertThat(defaultCfDef) .isEqualTo(expectedCfDef); }

Target:
public void testCreateTableDefaultCassandraMetadata() throws TException { String keyspace = CASSANDRA.getConfig().getKeyspaceOrThrow(); CfDef expectedCfDef = createDefaultCfDef(keyspace, CASSANDRA_DEFAULT_TABLE_NAME); keyValueService.createTable(ATLAS_DEFAULT_TABLE_REFERENCE, AtlasDbConstants.GENERIC_TABLE_METADATA); List<CfDef> cfDefs = ((CassandraKeyValueService) keyValueService).getClientPool() .run(client -> client.describe_keyspace(keyspace).getCf_defs()); List<CfDef> matches = cfDefs.stream() .filter(cfDef -> cfDef.name.equals(CASSANDRA_DEFAULT_TABLE_NAME)) .collect(Collectors.toList()); assertThat(matches).containsExactly(expectedCfDef); }
Source:
public SocketChannel requestForConnection(InetSocketAddress hostAddr) throws IOException, JSONException { SocketChannel socket = connectToHost(hostAddr); ByteBuffer currentTimeBuf = ByteBuffer.allocate(8); while (currentTimeBuf.hasRemaining()) { socket.read(currentTimeBuf); } assert(currentTimeBuf.position() == 8); JSONObject jsObj = new JSONObject(); jsObj.put(TYPE, ConnectionType.REQUEST_CONNECTION.name()); jsObj.put(VERSION_STRING, m_acceptor.getVersionChecker().getVersionString()); jsObj.put(HOST_ID, m_localHostId); jsObj.put(PORT, m_internalPort); jsObj.put(ADDRESS, m_internalInterface.isEmpty() ? m_reportedInternalInterface : m_internalInterface); byte[] jsBytes = jsObj.toString(4).getBytes(StandardCharsets.UTF_8); ByteBuffer addConnection = ByteBuffer.allocate(4 + jsBytes.length); addConnection.putInt(jsBytes.length); addConnection.put(jsBytes).flip(); while (addConnection.hasRemaining()) { socket.write(addConnection); } final String remoteAddress = socket.socket().getRemoteSocketAddress().toString(); processJSONResponse(socket, remoteAddress, null, false); return socket; }

Target:
public SocketChannel requestForConnection(InetSocketAddress hostAddr) throws IOException, JSONException { SocketChannel socket = connectToHost(hostAddr); ByteBuffer currentTimeBuf = ByteBuffer.allocate(8); while (currentTimeBuf.hasRemaining()) { socket.read(currentTimeBuf); } assert currentTimeBuf.position() == 8 : "time buffer is at an unexpected position"; JSONObject jsObj = new JSONObject(); jsObj.put(TYPE, ConnectionType.REQUEST_CONNECTION.name()); jsObj.put(VERSION_STRING, m_acceptor.getVersionChecker().getVersionString()); jsObj.put(HOST_ID, m_localHostId); jsObj.put(PORT, m_internalPort); jsObj.put(ADDRESS, m_internalInterface.isEmpty() ? m_reportedInternalInterface : m_internalInterface); byte[] jsBytes = jsObj.toString(4).getBytes(StandardCharsets.UTF_8); ByteBuffer addConnection = ByteBuffer.allocate(4 + jsBytes.length); addConnection.putInt(jsBytes.length); addConnection.put(jsBytes).flip(); while (addConnection.hasRemaining()) { socket.write(addConnection); } final String remoteAddress = socket.socket().getRemoteSocketAddress().toString(); processJSONResponse(socket, remoteAddress, null, false); return socket; }
Source:
public QualifierStep family(byte[] colFam, int colFamLength) { columnFamily = colFam; columnFamilyLength = colFamLength; return this; }

Target:
private QualifierStep family(byte[] colFam, int colFamLength) { columnFamily = colFam; columnFamilyLength = colFamLength; return this; }
Source:
private boolean isTooLarge(BigDecimal value) { return ( value.compareTo( BigDecimal.valueOf( Long.MAX_VALUE, decimalScale ) ) > 0 || value.compareTo( BigDecimal.valueOf( Long.MIN_VALUE, decimalScale ) ) < 0 ); }

Target:
private boolean isTooLarge(BigDecimal value) { return ( value.compareTo( minScaledValue ) < 0 || value.compareTo( maxScaledValue ) > 0 ); }
Source:
public Long deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException { Object memLimit = jsonParser.readValueAs(Object.class); if (memLimit instanceof Long) { return (Long) memLimit; } if (memLimit instanceof Integer) { return ((Integer) memLimit).longValue(); } if (memLimit instanceof String) { try { return Size.parseSize((String) memLimit); } catch (IllegalArgumentException e) { throw ctxt.mappingException(format(UNSUPPORTED_VALUE_MESSAGE, memLimit)); } } throw ctxt.mappingException(format(UNSUPPORTED_VALUE_MESSAGE, memLimit)); }

Target:
public Long deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException { Object memLimit = jsonParser.readValueAs(Object.class); if (memLimit instanceof Long) { return (Long) memLimit; } if (memLimit instanceof Integer) { return ((Integer) memLimit).longValue(); } if (memLimit instanceof String) { return Size.parseSize((String) memLimit); } throw ctxt.mappingException(format(UNSUPPORTED_VALUE_MESSAGE, memLimit)); }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mDrawerListView = (ListView) inflater.inflate(R.layout.fragment_navigation_drawer, container, false); mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectItem(position); } }); String[] menuOptions = getResources().getStringArray(R.array.menuOptions); mDrawerListView.setAdapter(new ArrayAdapter<>(getActionBar().getThemedContext(), R.layout.drawer_list_item, menuOptions)); mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); return mDrawerListView; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mDrawerListView = (ListView) inflater.inflate(R.layout.fragment_navigation_drawer, container, false); mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectItem(position); } }); String[] menuOptions = getResources().getStringArray(R.array.menuOptions); mDrawerListView.setAdapter(new ArrayAdapter<>(getSupportActionBar().getThemedContext(), R.layout.drawer_list_item, menuOptions)); mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); return mDrawerListView; }
Source:
private boolean shouldNotCache(@NotNull String path) { Intrinsics.checkParameterIsNotNull(bundleContext, "path"); return path.endsWith(".map"); }

Target:
private boolean shouldNotCache(@NotNull String path) { Intrinsics.checkParameterIsNotNull(path, "path"); return path.endsWith(".map"); }
Source:
public void add(Boolean bool) { if (bool == null) { elements.add(JsonNull.INSTANCE); } elements.add(new JsonPrimitive(bool)); }

Target:
public void add(Boolean bool) { elements.add(bool == null ? JsonNull.INSTANCE : new JsonPrimitive(bool)); }
Source:
public void resourceSetChanged(ResourceSetChangeEvent event) { super.resourceSetChanged(event); this.toRefreshInViewer = Sets.newLinkedHashSet(); this.toUpdateInViewer = Sets.newLinkedHashSet(); this.toCollapse = Sets.newLinkedHashSet(); this.toExpand = Sets.newLinkedHashSet(); for (Notification notif : event.getNotifications()) { notifyChanged(notif); } if (this.toRefreshInViewer.size() > 0 || this.toUpdateInViewer.size() > 0 || this.toCollapse.size() > 0 || this.toExpand.size() > 0) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { if (dTreeViewer != null && dTreeViewer.getControl() != null && !dTreeViewer.getControl().isDisposed()) { for (Object itemtoExpand : toExpand) { dTreeViewer.setExpandedState(itemtoExpand, true); } for (Object itemToCollapse : toCollapse) { dTreeViewer.setExpandedState(itemToCollapse, false); } for (Object itemToRefresh : toRefreshInViewer) { dTreeViewer.refresh(itemToRefresh, true); } Object[] objectsToUpdateInViewer = Sets.difference(toUpdateInViewer, toRefreshInViewer).toArray(new Object[0]); dTreeViewer.update(objectsToUpdateInViewer, null); } } }); } }

Target:
public void resourceSetChanged(ResourceSetChangeEvent event) { super.resourceSetChanged(event); this.toRefreshInViewer = Sets.newLinkedHashSet(); this.toUpdateInViewer = Sets.newLinkedHashSet(); this.toCollapse = Sets.newLinkedHashSet(); this.toExpand = Sets.newLinkedHashSet(); for (Notification notif : event.getNotifications()) { notifyChanged(notif); } if (this.toRefreshInViewer.size() > 0 || this.toUpdateInViewer.size() > 0 || this.toCollapse.size() > 0 || this.toExpand.size() > 0) { final Object[] objectsToUpdateInViewer = Sets.difference(toUpdateInViewer, toRefreshInViewer).toArray(new Object[0]); PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { if (dTreeViewer != null && dTreeViewer.getControl() != null && !dTreeViewer.getControl().isDisposed()) { for (Object itemtoExpand : toExpand) { dTreeViewer.setExpandedState(itemtoExpand, true); } for (Object itemToCollapse : toCollapse) { dTreeViewer.setExpandedState(itemToCollapse, false); } for (Object itemToRefresh : toRefreshInViewer) { dTreeViewer.refresh(itemToRefresh, true); } dTreeViewer.update(objectsToUpdateInViewer, null); } } }); } }
Source:
protected boolean OnLongClickListOffline(int position) { final int lapos = position; new MaterialDialog.Builder(getActivity()) .title(R.string.txtDialogsTitle) .content(R.string.txtDialogsContentDelete) .positiveText(R.string.txtYes) .negativeText(R.string.txtNo) .onPositive((dialog, which) -> { String barcode = saveItems.get(lapos).getBarcode(); Utils.getAppDaoSession(getActivity()).getSendProductDao().deleteInTx(Utils.getAppDaoSession(getActivity()).getSendProductDao().queryBuilder().where(SendProductDao.Properties.Barcode.eq(barcode)).list()); final SaveListAdapter sl = (SaveListAdapter) listView.getAdapter(); saveItems.remove(lapos); getActivity().runOnUiThread(() -> sl.notifyDataSetChanged()); }) .show(); return true; }

Target:
protected boolean OnLongClickListOffline(int position) { final int lapos = position; new MaterialDialog.Builder(getActivity()) .title(R.string.txtDialogsTitle) .content(R.string.txtDialogsContentDelete) .positiveText(R.string.txtYes) .negativeText(R.string.txtNo) .onPositive((dialog, which) -> { String barcode = saveItems.get(lapos).getBarcode(); mSendProductDao.deleteInTx(mSendProductDao.queryBuilder().where(SendProductDao.Properties.Barcode.eq(barcode)).list()); final SaveListAdapter sl = (SaveListAdapter) listView.getAdapter(); saveItems.remove(lapos); getActivity().runOnUiThread(() -> sl.notifyDataSetChanged()); }) .show(); return true; }
Source:
public ConnectorBucketNodeMap getBucketNodeMap(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle) { Set<Node> nodes = nodeManager.getRequiredWorkerNodes(); checkState(!nodes.isEmpty(), "No TPCH nodes available"); return new ConnectorBucketNodeMap(nodes.size() * splitsPerNode); }

Target:
public ConnectorBucketNodeMap getBucketNodeMap(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle) { Set<Node> nodes = nodeManager.getRequiredWorkerNodes(); return createBucketNodeMap(toIntExact((long) nodes.size() * splitsPerNode)); }
Source:
private void waitForView(int viewId, long timeout, TimeUnit timeUnit) throws InterruptedException { try { transport.withView(viewId).get(timeout, timeUnit); } catch (ExecutionException e) { log.errorf(e, "Unexpected exception waiting for view %d, current view is %d", viewId, transport.getViewId()); } catch (TimeoutException e) { throw log.timeoutWaitingForView(viewId, transport.getViewId()); } }

Target:
private void waitForView(int viewId, long timeout, TimeUnit timeUnit) throws InterruptedException { try { transport.withView(viewId).get(timeout, timeUnit); } catch (ExecutionException e) { throw new CacheException(e.getCause()); } catch (TimeoutException e) { throw log.timeoutWaitingForView(viewId, transport.getViewId()); } }
Source:
public void readResolveContainerCapZero() { KubernetesCloud cloud = j.jenkins.clouds.get(KubernetesCloud.class); assertTrue(cloud.getRemainingGlobalSlots(Collections.emptyList(), 1) > 0); }

Target:
public void readResolveContainerCapZero() { KubernetesCloud cloud = j.jenkins.clouds.get(KubernetesCloud.class); assertEquals(cloud.getContainerCap(), Integer.MAX_VALUE); assertThat(cloud.getRemainingGlobalSlots(Collections.emptyList(), 1), greaterThan(0)); }
Source:
public void writeTo(final OutputStream httpOut) throws IOException { multipartStream.setNext(httpOut); try { final int bufferSize = 128; IOUtils.copy(getContent(), cipherStream, bufferSize); cipherStream.flush(); } finally { IOUtils.closeQuietly(httpOut); } }

Target:
public void writeTo(final OutputStream httpOut) throws IOException { multipartStream.setNext(httpOut); try { IOUtils.copy(getContent(), cipherStream, BUFFER_SIZE); cipherStream.flush(); } finally { IOUtils.closeQuietly(httpOut); } }
Source:
private String getContentTypePostfix(String contentTypeValue) { String[] ctvArray = contentTypeValue.split(";"); String contentType = ""; String charset = ""; if (ctvArray.length > 1) { for (String segment : ctvArray) { if (segment.toLowerCase(Locale.ROOT).contains("charset")) { charset = segment.trim(); } else if (!segment.toLowerCase(Locale.ROOT).contains("boundary") && !segment.toLowerCase(Locale.ROOT).contains("charset") && !StringUtils.isBlank(segment)) { contentType = segment.trim(); } } if (StringUtils.isBlank(charset)) { return ctvArray[0].trim(); } return contentType + "; " + charset; } return ctvArray[0].trim(); }

Target:
private static String getContentTypePostfix(String contentTypeValue) { String[] ctvArray = contentTypeValue.split(";"); if (ctvArray.length == 1) { return ctvArray[0].trim(); } return Arrays.stream(ctvArray) .filter(StringUtils::isNotBlank) .filter(segment -> !segment.toLowerCase(Locale.ROOT).contains("boundary")) .map(String::trim) .collect(Collectors.joining("; ")); }
Source:
public PaymentWorksNewVendorPayeeAchBatchReportData() { super(); this.disapprovedVendorsSummary = new PaymentWorksBatchReportSummaryItem(); this.noAchDataProvidedVendorsSummary = new PaymentWorksBatchReportSummaryItem(); this.recordsWithForeignAchSummary = new PaymentWorksBatchReportSummaryItem(); this.noAchDataProvidedVendors = new ArrayList<PaymentWorksBatchReportVendorItem>(); this.pmwVendorAchsThatCouldNotBeProcessed = new ArrayList<PaymentWorksBatchReportVendorItem>(); this.disapprovedVendors = new ArrayList<PaymentWorksBatchReportVendorItem>(); this.recordsGeneratingException = new ArrayList<PaymentWorksBatchReportVendorItem>(); this.foreignAchItems = new ArrayList<PaymentWorksBatchReportVendorItem>();; }

Target:
public PaymentWorksNewVendorPayeeAchBatchReportData() { super(); this.disapprovedVendorsSummary = new PaymentWorksBatchReportSummaryItem(); this.noAchDataProvidedVendorsSummary = new PaymentWorksBatchReportSummaryItem(); this.recordsWithForeignAchSummary = new PaymentWorksBatchReportSummaryItem(); this.noAchDataProvidedVendors = new ArrayList<PaymentWorksBatchReportVendorItem>(); this.pmwVendorAchsThatCouldNotBeProcessed = new ArrayList<PaymentWorksBatchReportVendorItem>(); this.disapprovedVendors = new ArrayList<PaymentWorksBatchReportVendorItem>(); this.recordsGeneratingException = new ArrayList<PaymentWorksBatchReportVendorItem>(); this.foreignAchItems = new ArrayList<PaymentWorksBatchReportVendorItem>(); }
Source:
@Test public void requestAfterExecuteThrowingAlsoThrows() throws IOException { Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.url("/")) .addConverterFactory(new ToStringConverterFactory()) .build(); Service service = retrofit.create(Service.class); server.enqueue(new MockResponse()); final AtomicInteger writeCount = new AtomicInteger(); Object a = new Object() { @Override public String toString() { writeCount.incrementAndGet(); throw new RuntimeException("Broken!"); } }; Call<String> call = service.postRequestBody(a); try { call.execute(); } catch (RuntimeException e) { assertThat(e).hasMessage("Broken!"); } assertThat(writeCount.get()).isEqualTo(1); try { call.request(); } catch (RuntimeException e) { assertThat(e).hasMessage("Broken!"); } assertThat(writeCount.get()).isEqualTo(1); }

Target:
@Test public void requestAfterExecuteThrowingAlsoThrows() throws IOException { Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.url("/")) .addConverterFactory(new ToStringConverterFactory()) .build(); Service service = retrofit.create(Service.class); server.enqueue(new MockResponse()); final AtomicInteger writeCount = new AtomicInteger(); Object a = new Object() { @Override public String toString() { writeCount.incrementAndGet(); throw new RuntimeException("Broken!"); } }; Call<String> call = service.postRequestBody(a); try { call.execute(); fail(); } catch (RuntimeException e) { assertThat(e).hasMessage("Broken!"); } assertThat(writeCount.get()).isEqualTo(1); try { call.request(); fail(); } catch (RuntimeException e) { assertThat(e).hasMessage("Broken!"); } assertThat(writeCount.get()).isEqualTo(1); }
Source:
public void postOpenAppEvent_appLastOpenedDateOnEarlierDay_appLastOpenedDateUpdated() throws IllegalArgumentException, IllegalAccessException { UserDevice device = addDeviceToRichard(0, "First", OperatingSystem.ANDROID); LocalDate originalDate = TimeUtil.utcNow().toLocalDate().minusDays(1); richard.setAppLastOpenedDate(originalDate); appLastOpenedDateField.set(device, originalDate); service.postOpenAppEvent(richard.getId(), device.getId(), Optional.empty(), Optional.of(SOME_APP_VERSION), SUPPORTED_APP_VERSION_CODE); assertThat(richard.getAppLastOpenedDate().get(), equalTo(currentDateInAmsterdam())); assertThat(device.getAppLastOpenedDate(), equalTo(currentDateInAmsterdam())); verify(userRepository, times(1)).save(any(User.class)); }

Target:
public void postOpenAppEvent_appLastOpenedDateOnEarlierDay_appLastOpenedDateUpdated() { UserDevice device = addDeviceToRichard(0, "First", OperatingSystem.ANDROID); LocalDate originalDate = TimeUtil.utcNow().toLocalDate().minusDays(1); richard.setAppLastOpenedDate(originalDate); setAppLastOpenedDateField(device, originalDate); service.postOpenAppEvent(richard.getId(), device.getId(), Optional.empty(), Optional.of(SOME_APP_VERSION), SUPPORTED_APP_VERSION_CODE); assertThat(richard.getAppLastOpenedDate().get(), equalTo(currentDateInAmsterdam())); assertThat(device.getAppLastOpenedDate(), equalTo(currentDateInAmsterdam())); verify(userRepository, times(1)).save(any(User.class)); }
Source:
private List<StepDefinitionMatch> stepDefinitionMatches(String featurePath, PickleStep step) { List<StepDefinitionMatch> result = new ArrayList<StepDefinitionMatch>(); String stepText = step.getText(); CacheEntry cacheEntry = matchedStepDefinitionsCache.get(stepText); if (cacheEntry != null) { result.add(new StepDefinitionMatch(cacheEntry.arguments, cacheEntry.stepDefinition, featurePath, step, localizedXStreams)); return result; } boolean notFound = true; for (StepDefinition stepDefinition : stepDefinitionsByPattern.values()) { List<Argument> arguments = stepDefinition.matchedArguments(step); if (arguments != null) { if (notFound) { matchedStepDefinitionsCache.put(stepText, new CacheEntry(stepDefinition, arguments)); notFound = false; } else { matchedStepDefinitionsCache.remove(stepText); } result.add(new StepDefinitionMatch(arguments, stepDefinition, featurePath, step, localizedXStreams)); } } return result; }

Target:
private List<StepDefinitionMatch> stepDefinitionMatches(String featurePath, PickleStep step) { List<StepDefinitionMatch> result = new ArrayList<StepDefinitionMatch>(); for (StepDefinition stepDefinition : stepDefinitionsByPattern.values()) { List<Argument> arguments = stepDefinition.matchedArguments(step); if (arguments != null) { result.add(new StepDefinitionMatch(arguments, stepDefinition, featurePath, step, localizedXStreams)); } } return result; }
Source:
public void testQueryEvent() throws IOException, ServletException { List<Event> receivedEvents = new ArrayList<>(); QueryEventGenerator eventGenerator = mock(QueryEventGenerator.class); QueryEvent generatedEvent = mock(QueryEvent.class); String headerFlag = "headerFlag"; when(eventGenerator.instant()) .thenReturn(Instant.EPOCH) .thenReturn(Instant.EPOCH.plus(1, ChronoUnit.SECONDS)); HttpServletRequest request = mock(HttpServletRequest.class); when(request.getPathInfo()).thenReturn("/namespace/ns/sparql"); when(request.getParameter(eq(QueryEventGenerator.QUERY_PARAM))).thenReturn(SPARQL_QUERY); when(request.getHeader(eq(headerFlag))).thenReturn("yes"); HttpServletResponse response = mock(HttpServletResponse.class); when(eventGenerator.generateQueryEvent(eq(request), eq(200), eq(new HashMap<String, String>() {{ put("response_header", "header_value"); }}), eq(Duration.ofSeconds(1)), eq(Instant.EPOCH)) ).thenReturn(generatedEvent); FilterChain filterChain = mock(FilterChain.class); when(response.getStatus()).thenReturn(200); when(response.getHeaderNames()).thenReturn(Collections.singletonList("response_header")); when(response.getHeaders(eq("response_header"))).thenReturn(Collections.singletonList("header_value")); QueryEventSenderFilter filter = new QueryEventSenderFilter(receivedEvents::add, eventGenerator, headerFlag); filter.doFilter(request, response, filterChain); assertThat(receivedEvents).containsExactly(generatedEvent); verify(filterChain, times(1)).doFilter(eq(request), eq(response)); }

Target:
public void testQueryEvent() throws IOException, ServletException { List<Event> receivedEvents = new ArrayList<>(); QueryEventGenerator eventGenerator = mock(QueryEventGenerator.class); QueryEvent generatedEvent = mock(QueryEvent.class); String headerFlag = "headerFlag"; String defaultNS = "defaultNS"; when(eventGenerator.instant()) .thenReturn(Instant.EPOCH) .thenReturn(Instant.EPOCH.plus(1, SECONDS)); HttpServletRequest request = mock(HttpServletRequest.class); ServletContext context = mock(ServletContext.class); when(context.getAttribute(eq(WikibaseContextListener.BLAZEGRAPH_DEFAULT_NAMESPACE))).thenReturn(defaultNS); when(request.getPathInfo()).thenReturn("/namespace/ns/sparql"); when(request.getParameter(eq(QueryEventGenerator.QUERY_PARAM))).thenReturn(SPARQL_QUERY); when(request.getHeader(eq(headerFlag))).thenReturn("yes"); when(request.getServletContext()).thenReturn(context); HttpServletResponse response = mock(HttpServletResponse.class); when(eventGenerator.generateQueryEvent(eq(request), eq(200), eq(Duration.ofSeconds(1)), eq(Instant.EPOCH), eq(defaultNS))) .thenReturn(generatedEvent); FilterChain filterChain = mock(FilterChain.class); when(response.getStatus()).thenReturn(200); QueryEventSenderFilter filter = new QueryEventSenderFilter(receivedEvents::add, eventGenerator, headerFlag); filter.doFilter(request, response, filterChain); assertThat(receivedEvents).containsExactly(generatedEvent); verify(filterChain, times(1)).doFilter(eq(request), eq(response)); }
Source:
protected void executeCommand() { getParameters().setLifeInMinutes(LIFETIME); verifyImageRemoval(); }

Target:
protected void executeCommand() { verifyImageRemoval(); }
Source:
private static TimeLimiterRegistry createTimeLimiterRegistry( TimeLimiterConfigurationProperties timeLimiterConfigurationProperties, RegistryEventConsumer<TimeLimiter> timeLimiterRegistryEventConsumer, CompositeCustomizer<TimeLimiterConfigCustomizer> compositeTimeLimiterCustomizer) { Map<String, TimeLimiterConfig> configs = timeLimiterConfigurationProperties.getConfigs() .entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> timeLimiterConfigurationProperties.createTimeLimiterConfig( entry.getKey(), entry.getValue(), compositeTimeLimiterCustomizer))); return TimeLimiterRegistry.of(configs, timeLimiterRegistryEventConsumer, timeLimiterConfigurationProperties.getTags()); }

Target:
private static TimeLimiterRegistry createTimeLimiterRegistry( TimeLimiterConfigurationProperties timeLimiterConfigurationProperties, RegistryEventConsumer<TimeLimiter> timeLimiterRegistryEventConsumer, CompositeCustomizer<TimeLimiterConfigCustomizer> compositeTimeLimiterCustomizer) { Map<String, TimeLimiterConfig> configs = timeLimiterConfigurationProperties.getConfigs() .entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> timeLimiterConfigurationProperties.createTimeLimiterConfig( entry.getKey(), entry.getValue(), compositeTimeLimiterCustomizer))); return TimeLimiterRegistry.of(configs, timeLimiterRegistryEventConsumer, Map.copyOf(timeLimiterConfigurationProperties.getTags())); }
Source:
public Map<String,Object> getKeyStructureFields (String structureInode) { Map<String,Object> result = new HashMap<String, Object>(); boolean allowImport = true; Structure struct = CacheLocator.getContentTypeCache().getStructureByInode(structureInode); List<Field> fields = struct.getFields(); ArrayList<Map> searchableFields = new ArrayList<Map> (); for (Field field : fields) { if (!field.getFieldType().equals(Field.FieldType.LINE_DIVIDER.toString()) && !field.getFieldType().equals(Field.FieldType.FILE.toString()) && !field.getFieldType().equals(Field.FieldType.IMAGE.toString())&& !field.getFieldType().equals(Field.FieldType.LINE_DIVIDER.toString()) && !field.getFieldType().equals(Field.FieldType.TAB_DIVIDER.toString())) { try { Map fieldMap = field.getMap(); searchableFields.add(fieldMap); } catch (Exception e) { Logger.error(this, "Error getting the map of properties of a field: " + field.getInode()); } } } try { List<WorkflowScheme> schemes = APILocator.getWorkflowAPI().findSchemeForStruct(struct); for(WorkflowScheme scheme : schemes) { if (scheme.isMandatory() && !UtilMethods.isSet(scheme.getEntryActionId())) { allowImport = false; } } } catch (DotDataException e) { Logger.error(this, e.getMessage()); } result.put("keyStructureFields",searchableFields); result.put("allowImport", allowImport); return result; }

Target:
public Map<String,Object> getKeyStructureFields (String structureInode) { Map<String,Object> result = new HashMap<String, Object>(); boolean allowImport = true; Structure struct = CacheLocator.getContentTypeCache().getStructureByInode(structureInode); List<Field> fields = struct.getFields(); ArrayList<Map> searchableFields = new ArrayList<Map> (); for (Field field : fields) { if (!field.getFieldType().equals(Field.FieldType.LINE_DIVIDER.toString()) && !field.getFieldType().equals(Field.FieldType.FILE.toString()) && !field.getFieldType().equals(Field.FieldType.IMAGE.toString())&& !field.getFieldType().equals(Field.FieldType.LINE_DIVIDER.toString()) && !field.getFieldType().equals(Field.FieldType.TAB_DIVIDER.toString())) { try { Map fieldMap = field.getMap(); searchableFields.add(fieldMap); } catch (Exception e) { Logger.error(this, "Error getting the map of properties of a field: " + field.getInode()); } } } try { List<WorkflowScheme> schemes = APILocator.getWorkflowAPI().findSchemesForStruct(struct); for(WorkflowScheme scheme : schemes) { if (scheme.isMandatory() && !UtilMethods.isSet(scheme.getEntryActionId())) { allowImport = false; break; } } } catch (DotDataException e) { Logger.error(this, e.getMessage()); } result.put("keyStructureFields",searchableFields); result.put("allowImport", allowImport); return result; }