NEW YORK (AP) — J.C. Penney, which is struggling with big losses and steep sales declines, could face another challenge: empty shelves.

New York State Supreme Court Judge Jeffrey Oing told Penney's attorneys on Monday that the chain took a risk by ordering towels, cookware and other products from the company that home diva Martha Stewart founded. In fact, Oing said he could force Penney to stop the products from heading to the shelves this spring even as they come off the docks.

Oing said he will hear oral arguments on Friday over the issue of whether Penney can sell goods like towels designed by Martha Stewart Living that are covered by Macy's exclusive agreement but are not sold under the Martha Stewart brand name.

The judge's statements came during the start of the third week in a trial that pits J.C. Penney Co. against rival Macy's Inc. over their relationship with Martha Stewart Living Omnimedia Inc. At issue is whether Macy's has the exclusive right to sell some of Martha Stewart branded products such as cookware, bedding and bath.

Penney, in a statement released Monday, said Penney said that it would not have proceeded with its agreement with the media and merchandising company if Penney thought it would interfere in any way with its pact with Martha Stewart Living.

"Macy's is attempting to gain through the lawsuit more rights than it actually has under its written contract with" Martha Stewart Living, the company said in the statement.

Macy's has argued that Penney breached its long-standing contract when it signed a deal in December 2011 to open Martha Stewart mini shops in most of its stores this spring. Macy's, which has been the exclusive carrier of some Martha Stewart products including towels and pots since 2007, is trying to block Penney from selling those products. It also wants to stop Martha Stewart from providing any designs to Penney — whether or not it carries the Martha Stewart label.

Last July, Macy's won a preliminary injunction against Martha Stewart Living that would prevent it from selling housewares and other exclusive products at Penney. In August, the judge granted permission for Penney to open Martha Stewart shops as long as the items under the exclusive contract with Macy's are not sold in them.

But Penney took a more liberal interpretation of the preliminary ruling. Penney said it plans to sell products that are part of Macy's exclusive agreement in May. The goods will be branded under JCP Everyday, a new brand reserved for the home diva's merchandise. Penney also plans to sell products like curtains and stationery that are not a part of the exclusive Macy's contract under the label "Martha."

Mark H. Epstein, representing Penney, argued that a decision to block the department store from selling goods like towels and bedding that don't carry the Martha Stewart label would be devastating because the company doesn't have a substitute.

Oing said even though he understands the financial repercussions, his decision can't be influenced by financial matters.

"These three companies are the fabric of America," Oing said. "I haven't decided what I am going to do. I'm keeping the cat in the bag."

The stakes are high for all three companies. Macy's CEO Terry Lundgren testified last week that the Cincinnati-based department store chain built the Martha Stewart brand to become the biggest name in the home area, and having a rival carry similar products would hurt business.

Martha Stewart Living, based in New York City, is trying to fatten merchandising revenue as it struggles to offset declines in its broadcast and publishing business, a segment that accounts for more than 60 percent of its total business. Martha Stewart is expected to testify Tuesday.

But perhaps the company with the most to lose is Penney. The company, based in Plano, Texas, is in the middle of a turnaround plan that's faltering: The company has reported big losses and sales declines for four straight quarters since it started a strategy to get rid of most of its sales in favor of everyday low prices last year. Penney, which started to roll out shops last fall, has been counting on a reinvented home area to attract shoppers. It had planned to use the Martha Stewart brand as the anchor.

Brian Sozzi,, a retail industry analyst with NBG Productions, said that if Penney ends up being forced to give up the JCP Everyday line of products, it could have a "mushrooming effect" just as worries abound that the company is burning through cash.